SessionMenu: add lock & suspend option as requested in #301

This commit is contained in:
Ly-sec
2025-09-28 19:50:52 +02:00
parent c7c49433f7
commit ffd2cdaf74
5 changed files with 16 additions and 8 deletions
+2
View File
@@ -1243,6 +1243,8 @@
"click-again": "Click again to execute immediately",
"action-in-seconds": "{action} in {seconds} seconds...",
"lock-subtitle": "Lock your session",
"lock-and-suspend": "Lock and Suspend",
"lock-and-suspend-subtitle": "Lock session and put system to sleep",
"end-subtitle": "End your session",
"lock": "Lock",
"suspend": "Suspend",
+1
View File
@@ -45,6 +45,7 @@ Singleton {
"keyboard": "keyboard",
"shutdown": "power",
"lock": "lock",
"lock-pause": "lock-pause",
"logout": "logout",
"reboot": "refresh",
"suspend": "player-pause",
+12 -1
View File
@@ -14,7 +14,7 @@ NPanel {
id: root
preferredWidth: 440
preferredHeight: 410
preferredHeight: 480
panelAnchorHorizontalCenter: true
panelAnchorVerticalCenter: true
panelKeyboardFocus: true
@@ -32,6 +32,11 @@ NPanel {
"icon": "lock",
"title": I18n.tr("session-menu.lock"),
"subtitle": I18n.tr("session-menu.lock-subtitle")
}, {
"action": "lockAndSuspend",
"icon": "lock-pause",
"title": I18n.tr("session-menu.lock-and-suspend"),
"subtitle": I18n.tr("session-menu.lock-and-suspend-subtitle")
}, {
"action": "suspend",
"icon": "suspend",
@@ -97,6 +102,12 @@ NPanel {
lockScreen.active = true
}
break
case "lockAndSuspend":
if (!lockScreen.active) {
lockScreen.active = true
}
CompositorService.suspend()
break
case "suspend":
CompositorService.suspend()
break
-6
View File
@@ -251,10 +251,4 @@ ColumnLayout {
}
}
}
NDivider {
Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling
}
}
+1 -1
View File
@@ -115,7 +115,7 @@ Singleton {
"id": id,
"summary": (n.summary || ""),
"body": stripTags(n.body || ""),
"appName": getAppName(n.appName || n.desktopEntry || ""),
"appName": getAppName(n.appName),
"urgency": n.urgency < 0 || n.urgency > 2 ? 1 : n.urgency,
"expireTimeout": n.expireTimeout,
"timestamp": time,