diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Lockscreen.qml')
| -rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Lockscreen.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml index 8e739359..e4f8e1c9 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 | ||
| @@ -56,6 +88,8 @@ Scope { | |||
| 56 | } | 88 | } |
| 57 | } | 89 | } |
| 58 | 90 | ||
| 91 | onSecureStateChanged: Custom.Systemd.lockedHint = lock.secure | ||
| 92 | |||
| 59 | WlSessionLockSurface { | 93 | WlSessionLockSurface { |
| 60 | id: lockSurface | 94 | id: lockSurface |
| 61 | 95 | ||
