Skip to content

Commit 1bcc062

Browse files
committed
Fix: Initial index update on empty userModel
#41 Prevent initial call to selector.userChanged() if the userModel is empty.
1 parent 46a99c4 commit 1bcc062

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ git clone -b main --depth=1 https://github.com/uiriansan/SilentSDDM && cd Silent
7676
> [!IMPORTANT]
7777
> Make sure to test the theme before rebooting by running `./test.sh`, otherwise you might end up with a broken login screen. Refer to the [snippets page](https://github.com/uiriansan/SilentSDDM/wiki/Snippets) if something goes wrong and [open an issue](https://github.com/uiriansan/SilentSDDM/issues/new/choose) if you don't find the solution there.
7878
79-
> [!NOTE]
80-
> If you encounter issues with the login screen not updating after changes, try clearing SDDM's cache:
81-
> ```bash
82-
> sudo rm -rf /var/lib/sddm/.cache
83-
> ```
84-
8579
## AUR packages for Arch
8680
If you run Arch Linux, consider installing one of the AUR packages:
8781
```bash

components/LoginScreen.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Item {
320320
enabled: loginScreen.state !== "selectingUser" && loginScreen.state !== "authenticating"
321321
activeFocusOnTab: true
322322
icon: Config.getIcon(Config.loginButtonIcon)
323-
label: textConstants.login ? textConstants.login.toUpperCase() : "LOGIN"
323+
label: textConstants.login ? textConstants.login : "Login"
324324
showLabel: Config.loginButtonShowTextIfNoPassword && !loginScreen.userNeedsPassword
325325
tooltipText: !Config.tooltipsDisableLoginButton && (!Config.loginButtonShowTextIfNoPassword || loginScreen.userNeedsPassword) ? (textConstants.login || "Login") : ""
326326
iconSize: Config.loginButtonIconSize

components/UserSelector.qml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ Item {
4747
model: userModel
4848
currentIndex: userModel.lastIndex
4949
onCurrentIndexChanged: {
50-
var username = userModel.data(userModel.index(currentIndex, 0), 257);
51-
var userRealName = userModel.data(userModel.index(currentIndex, 0), 258);
52-
var userIcon = userModel.data(userModel.index(currentIndex, 0), 260);
53-
var needsPasswd = userModel.data(userModel.index(currentIndex, 0), 261);
50+
if (loginScreen.foundUsers) {
51+
var username = userModel.data(userModel.index(currentIndex, 0), 257);
52+
var userRealName = userModel.data(userModel.index(currentIndex, 0), 258);
53+
var userIcon = userModel.data(userModel.index(currentIndex, 0), 260);
54+
var needsPasswd = userModel.data(userModel.index(currentIndex, 0), 261);
5455

55-
sddm.currentUser = username;
56-
selector.userChanged(currentIndex, username, userRealName, userIcon, needsPasswd);
56+
sddm.currentUser = username;
57+
selector.userChanged(currentIndex, username, userRealName, userIcon, needsPasswd);
58+
}
5759
}
5860

5961
delegate: Rectangle {

docs/Snippets.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ sudoedit /etc/pam.d/sddm
3434
auth include system-login
3535
```
3636

37-
The theme should now hide the password input if you select the user. You can test this by running `./test`.
37+
The theme should now hide the password input if you select the user. You can test this by running `./test.sh`.
3838

3939
# Change user face (avatar)
4040
There is a script included with the theme:
@@ -73,4 +73,10 @@ sudoedit /etc/sddm.conf
7373

7474
# Append `LIBVA_DRIVER_NAME=` and `QT_MULTIMEDIA_PREFERRED_PLUGINS=` to the end of the line:
7575
GreeterEnvironment=QML2_IMPORT_PATH=/usr/share/sddm/themes/silent/components/,QT_IM_MODULE=qtvirtualkeyboard,LIBVA_DRIVER_NAME=,QT_MULTIMEDIA_PREFERRED_PLUGINS=
76-
```
76+
```
77+
78+
# Fix theme not updating after changes or SDDM loading fallback theme with errors:
79+
Try clearing SDDM's cache:
80+
```bash
81+
sudo rm -rf /var/lib/sddm/.cache
82+
```

0 commit comments

Comments
 (0)