summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-16 00:42:36 +1000
committerGitHub <noreply@github.com>2025-06-16 00:42:36 +1000
commita1da662c387dfaa21ffe0fe43af18d4ecbed8ae8 (patch)
treede567e4a2927e9dee91d561f1ec2a3638148d88f /modules
parentreadme: overhaul finished! (diff)
parentlauncher: completely hide disabled actions (diff)
downloadcaelestia-shell-a1da662c387dfaa21ffe0fe43af18d4ecbed8ae8.tar.gz
caelestia-shell-a1da662c387dfaa21ffe0fe43af18d4ecbed8ae8.tar.bz2
caelestia-shell-a1da662c387dfaa21ffe0fe43af18d4ecbed8ae8.zip
Merge pull request #52 from thaemisch/betteractions
launcher: add shutdown, reboot and logout to actions
Diffstat (limited to 'modules')
-rw-r--r--modules/launcher/Actions.qml55
1 files changed, 54 insertions, 1 deletions
diff --git a/modules/launcher/Actions.qml b/modules/launcher/Actions.qml
index beb77a5..ae732db 100644
--- a/modules/launcher/Actions.qml
+++ b/modules/launcher/Actions.qml
@@ -68,6 +68,39 @@ Singleton {
}
},
Action {
+ name: qsTr("Shutdown")
+ desc: qsTr("Shutdown the system")
+ icon: "power_settings_new"
+ disabled: !Config.launcher.enableDangerousActions
+
+ function onClicked(list: AppList): void {
+ list.visibilities.launcher = false;
+ shutdown.running = true;
+ }
+ },
+ Action {
+ name: qsTr("Reboot")
+ desc: qsTr("Reboot the system")
+ icon: "cached"
+ disabled: !Config.launcher.enableDangerousActions
+
+ function onClicked(list: AppList): void {
+ list.visibilities.launcher = false;
+ reboot.running = true;
+ }
+ },
+ Action {
+ name: qsTr("Logout")
+ desc: qsTr("Log out of the current session")
+ icon: "exit_to_app"
+ disabled: !Config.launcher.enableDangerousActions
+
+ function onClicked(list: AppList): void {
+ list.visibilities.launcher = false;
+ logout.running = true;
+ }
+ },
+ Action {
name: qsTr("Lock")
desc: qsTr("Lock the current session")
icon: "lock"
@@ -89,7 +122,7 @@ Singleton {
}
]
- readonly property list<var> preppedActions: list.map(a => ({
+ readonly property list<var> preppedActions: list.filter(a => !a.disabled).map(a => ({
name: Fuzzy.prepare(a.name),
desc: Fuzzy.prepare(a.desc),
action: a
@@ -108,6 +141,24 @@ Singleton {
}
Process {
+ id: shutdown
+
+ command: ["systemctl", "poweroff"]
+ }
+
+ Process {
+ id: reboot
+
+ command: ["systemctl", "reboot"]
+ }
+
+ Process {
+ id: logout
+
+ command: ["sh", "-c", "(uwsm stop | grep -q 'Compositor is not running' && loginctl terminate-user $USER) || uwsm stop"]
+ }
+
+ Process {
id: lock
command: ["loginctl", "lock-session"]
@@ -123,6 +174,8 @@ Singleton {
required property string name
required property string desc
required property string icon
+ property bool disabled
+ property string disabledReason
function onClicked(list: AppList): void {
}