mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-02 10:37:50 +00:00
SessionMenu: move lockAndSuspend to CompositorService
This commit is contained in:
@@ -103,10 +103,7 @@ NPanel {
|
||||
}
|
||||
break
|
||||
case "lockAndSuspend":
|
||||
if (!lockScreen.active) {
|
||||
lockScreen.active = true
|
||||
}
|
||||
CompositorService.suspend()
|
||||
CompositorService.lockAndSuspend()
|
||||
break
|
||||
case "suspend":
|
||||
CompositorService.suspend()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user