diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-16 00:42:09 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-16 00:42:09 +1000 |
| commit | a44910d3971b1eb7ce0b755ac98bdd35c6c3574e (patch) | |
| tree | 953a20970fad86b6bbd545ace51f5c82d3d5a737 /modules/launcher/Actions.qml | |
| parent | Merge branch 'main' into betteractions (diff) | |
| download | caelestia-shell-a44910d3971b1eb7ce0b755ac98bdd35c6c3574e.tar.gz caelestia-shell-a44910d3971b1eb7ce0b755ac98bdd35c6c3574e.tar.bz2 caelestia-shell-a44910d3971b1eb7ce0b755ac98bdd35c6c3574e.zip | |
launcher: completely hide disabled actions
Diffstat (limited to 'modules/launcher/Actions.qml')
| -rw-r--r-- | modules/launcher/Actions.qml | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/modules/launcher/Actions.qml b/modules/launcher/Actions.qml index 1f6e72b..ae732db 100644 --- a/modules/launcher/Actions.qml +++ b/modules/launcher/Actions.qml @@ -71,33 +71,33 @@ Singleton { name: qsTr("Shutdown") desc: qsTr("Shutdown the system") icon: "power_settings_new" - disabled: !LauncherConfig.allowDangerousActions - disabledReason: qsTr("Enable dangerous actions in config/LauncherConfig.qml first") + disabled: !Config.launcher.enableDangerousActions function onClicked(list: AppList): void { - root.handleDangerousAction(list, shutdown); + list.visibilities.launcher = false; + shutdown.running = true; } }, Action { name: qsTr("Reboot") desc: qsTr("Reboot the system") icon: "cached" - disabled: !LauncherConfig.allowDangerousActions - disabledReason: qsTr("Enable dangerous actions in config/LauncherConfig.qml first") + disabled: !Config.launcher.enableDangerousActions function onClicked(list: AppList): void { - root.handleDangerousAction(list, reboot); + list.visibilities.launcher = false; + reboot.running = true; } }, Action { name: qsTr("Logout") - desc: qsTr("Logout of the current session") + desc: qsTr("Log out of the current session") icon: "exit_to_app" - disabled: !LauncherConfig.allowDangerousActions - disabledReason: qsTr("Enable dangerous actions in config/LauncherConfig.qml first") + disabled: !Config.launcher.enableDangerousActions function onClicked(list: AppList): void { - root.handleDangerousAction(list, logout); + list.visibilities.launcher = false; + logout.running = true; } }, Action { @@ -122,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 @@ -140,21 +140,6 @@ Singleton { list.search.text = `${Config.launcher.actionPrefix}${text} `; } - function handleDangerousAction(list: AppList, process: QtObject): void { - list.visibilities.launcher = false; - if (!LauncherConfig.allowDangerousActions) { - dangerousActions.running = true; - return; - } - process.running = true; - } - - Process { - id: dangerousActions - - command: ["notify-send", "Quickshell", qsTr("Enable dangerous actions in config/LauncherConfig.qml to use this action."), "-i", "dialog-warning"] - } - Process { id: shutdown @@ -171,7 +156,7 @@ Singleton { id: logout command: ["sh", "-c", "(uwsm stop | grep -q 'Compositor is not running' && loginctl terminate-user $USER) || uwsm stop"] - } + } Process { id: lock |