diff --git a/quickshell/modules/lockscreen/LockscreenContent.qml b/quickshell/modules/lockscreen/LockscreenContent.qml index 6f30482..d902db3 100644 --- a/quickshell/modules/lockscreen/LockscreenContent.qml +++ b/quickshell/modules/lockscreen/LockscreenContent.qml @@ -162,9 +162,23 @@ Item { border.width: 2 Layout.alignment: Qt.AlignHCenter - // Avatar Icon / Initial Badge + clip: true + + // Profile Picture from KDE Settings / AccountsService + Image { + id: avatarImg + anchors.fill: parent + source: LockscreenService.avatarPath + fillMode: Image.PreserveAspectCrop + visible: status === Image.Ready && source !== "" + smooth: true + asynchronous: true + } + + // Avatar Icon / Initial Badge (Fallback) Text { anchors.centerIn: parent + visible: !avatarImg.visible text: LockscreenService.username ? LockscreenService.username.charAt(0).toUpperCase() : "U" color: Theme.accent font.pixelSize: 42 diff --git a/quickshell/services/LockscreenService.qml b/quickshell/services/LockscreenService.qml index fc69890..f93c974 100644 --- a/quickshell/services/LockscreenService.qml +++ b/quickshell/services/LockscreenService.qml @@ -14,6 +14,7 @@ Item { property int typedCount: 0 property string username: "" property string realName: "" + property string avatarPath: "" // Signal emitted whenever a key is typed to trigger animated dot entry/bounce signal keyTyped(string char) @@ -31,6 +32,18 @@ Item { Component.onCompleted: { usernameProc.running = true + avatarProc.running = true + } + + Process { + id: avatarProc + command: ["python3", "-c", "import os; u = os.environ.get('USER', ''); paths = [f'/var/lib/AccountsService/icons/{u}', os.path.expanduser('~/.face'), os.path.expanduser('~/.face.icon')]; print(next((p for p in paths if os.path.exists(p) and os.path.getsize(p) > 0), ''))"] + stdout: SplitParser { + onRead: data => { + let p = data.trim() + if (p !== "") root.avatarPath = "file://" + p + } + } } Timer {