feat(lockscreen): inherit user profile picture set in KDE Settings / AccountsService
This commit is contained in:
parent
550a28d02d
commit
01b9d4ba4e
@ -162,9 +162,23 @@ Item {
|
|||||||
border.width: 2
|
border.width: 2
|
||||||
Layout.alignment: Qt.AlignHCenter
|
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 {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
visible: !avatarImg.visible
|
||||||
text: LockscreenService.username ? LockscreenService.username.charAt(0).toUpperCase() : "U"
|
text: LockscreenService.username ? LockscreenService.username.charAt(0).toUpperCase() : "U"
|
||||||
color: Theme.accent
|
color: Theme.accent
|
||||||
font.pixelSize: 42
|
font.pixelSize: 42
|
||||||
|
|||||||
@ -14,6 +14,7 @@ Item {
|
|||||||
property int typedCount: 0
|
property int typedCount: 0
|
||||||
property string username: ""
|
property string username: ""
|
||||||
property string realName: ""
|
property string realName: ""
|
||||||
|
property string avatarPath: ""
|
||||||
|
|
||||||
// Signal emitted whenever a key is typed to trigger animated dot entry/bounce
|
// Signal emitted whenever a key is typed to trigger animated dot entry/bounce
|
||||||
signal keyTyped(string char)
|
signal keyTyped(string char)
|
||||||
@ -31,6 +32,18 @@ Item {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
usernameProc.running = true
|
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 {
|
Timer {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user