mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-07 12:25:15 +00:00
SessionMenu: move lockAndSuspend to CompositorService
This commit is contained in:
@@ -103,10 +103,7 @@ NPanel {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "lockAndSuspend":
|
case "lockAndSuspend":
|
||||||
if (!lockScreen.active) {
|
CompositorService.lockAndSuspend()
|
||||||
lockScreen.active = true
|
|
||||||
}
|
|
||||||
CompositorService.suspend()
|
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
CompositorService.suspend()
|
CompositorService.suspend()
|
||||||
|
|||||||
@@ -167,4 +167,16 @@ Singleton {
|
|||||||
function suspend() {
|
function suspend() {
|
||||||
Quickshell.execDetached(["systemctl", "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