SessionMenu: move lockAndSuspend to CompositorService

This commit is contained in:
Ly-sec
2025-09-29 14:20:15 +02:00
parent 250822e819
commit b8b54825d5
2 changed files with 13 additions and 4 deletions
+12
View File
@@ -167,4 +167,16 @@ Singleton {
function suspend() {
Quickshell.execDetached(["systemctl", "suspend"])
}
function lockAndSuspend() {
try {
if (PanelService && PanelService.lockScreen && !PanelService.lockScreen.active) {
PanelService.lockScreen.active = true
}
} catch (e) {
Logger.warn("Compositor", "Failed to activate lock screen before suspend: " + e)
}
// Queue suspend to the next event loop cycle to allow lock UI to render
Qt.callLater(suspend)
}
}