summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Lockscreen.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Lockscreen.qml41
1 files changed, 40 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
index 8e739359..ac2e38f8 100644
--- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
+++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
@@ -38,6 +38,43 @@ Scope {
38 function getLocked(): bool { return lock.locked; } 38 function getLocked(): bool { return lock.locked; }
39 } 39 }
40 40
41 Connections {
42 target: Custom.Systemd
43 function onSleep(before: bool) {
44 console.log(`received prepare for sleep ${before}`);
45 if (before)
46 lock.locked = true;
47 }
48 function onLock() { lock.locked = true; }
49 function onUnlock() { lock.locked = false; }
50 }
51
52 IdleMonitor {
53 id: idleMonitor
54 enabled: !lock.secure
55 timeout: 600
56 respectInhibitors: true
57
58 onIsIdleChanged: {
59 if (idleMonitor.isIdle)
60 lock.locked = true;
61 }
62 }
63
64 Custom.SystemdInhibitor {
65 enabled: !lock.secure
66
67 what: Custom.SystemdInhibitorParams.Sleep
68 who: "quickshell"
69 why: "Lock session"
70 mode: Custom.SystemdInhibitorParams.Delay
71 }
72
73 Scope {
74 id: mprisProxy
75 property list<var> players: Mpris.players.values
76 }
77
41 WlSessionLock { 78 WlSessionLock {
42 id: lock 79 id: lock
43 80
@@ -47,7 +84,7 @@ Scope {
47 84
48 if (locked) { 85 if (locked) {
49 Custom.KeePassXC.lockAllDatabases(); 86 Custom.KeePassXC.lockAllDatabases();
50 Array.from(Mpris.players.values).forEach(player => { 87 Array.from(mprisProxy.players).forEach(player => {
51 if (player.canPause && player.isPlaying) 88 if (player.canPause && player.isPlaying)
52 player.pause(); 89 player.pause();
53 }); 90 });
@@ -56,6 +93,8 @@ Scope {
56 } 93 }
57 } 94 }
58 95
96 onSecureStateChanged: Custom.Systemd.lockedHint = lock.secure
97
59 WlSessionLockSurface { 98 WlSessionLockSurface {
60 id: lockSurface 99 id: lockSurface
61 100