diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Lockscreen.qml')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Lockscreen.qml | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml index 8e739359..124f441b 100644 --- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml +++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml | |||
@@ -38,6 +38,38 @@ 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 | |||
41 | WlSessionLock { | 73 | WlSessionLock { |
42 | id: lock | 74 | id: lock |
43 | 75 | ||
@@ -46,8 +78,9 @@ Scope { | |||
46 | pam.abort(); | 78 | pam.abort(); |
47 | 79 | ||
48 | if (locked) { | 80 | if (locked) { |
81 | NiriService.sendCommand({ "Action": { "PowerOffMonitors": {} } }); | ||
49 | Custom.KeePassXC.lockAllDatabases(); | 82 | Custom.KeePassXC.lockAllDatabases(); |
50 | Array.from(Mpris.players.values).forEach(player => { | 83 | Array.from(MprisProxy.players).forEach(player => { |
51 | if (player.canPause && player.isPlaying) | 84 | if (player.canPause && player.isPlaying) |
52 | player.pause(); | 85 | player.pause(); |
53 | }); | 86 | }); |
@@ -56,6 +89,10 @@ Scope { | |||
56 | } | 89 | } |
57 | } | 90 | } |
58 | 91 | ||
92 | Binding { target: MprisProxy; } | ||
93 | |||
94 | onSecureStateChanged: Custom.Systemd.lockedHint = lock.secure | ||
95 | |||
59 | WlSessionLockSurface { | 96 | WlSessionLockSurface { |
60 | id: lockSurface | 97 | id: lockSurface |
61 | 98 | ||