From 7dc5b65d2221bf6ed5f33cd8666ea4214c63f1d2 Mon Sep 17 00:00:00 2001 From: "Joel R." <59534812+h0useofdupree@users.noreply.github.com> Date: Tue, 29 Jul 2025 04:45:33 +0200 Subject: session: add custom session/lock menu button commands (#292) * session: add custom menu-buttons commands * lock: use custom session-menu buttons * readme: update config options for custom commands --- README.md | 8 +++++++- config/SessionConfig.qml | 8 ++++++++ modules/lock/Buttons.qml | 8 ++++---- modules/session/Content.qml | 8 ++++---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ff767eb..fd26863 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,13 @@ All configuration options are in `~/.config/caelestia/shell.json`. "useFahrenheit": false }, "session": { - "dragThreshold": 30 + "dragThreshold": 30, + "commands": { + "logout": ["loginctl", "terminate-user", ""], + "shutdown": ["systemctl", "poweroff"], + "hibernate": ["systemctl", "hibernate"], + "reboot": ["systemctl", "reboot"] + } } } ``` diff --git a/config/SessionConfig.qml b/config/SessionConfig.qml index 753d5c1..e47f294 100644 --- a/config/SessionConfig.qml +++ b/config/SessionConfig.qml @@ -3,7 +3,15 @@ import Quickshell.Io JsonObject { property bool enabled: true property int dragThreshold: 30 + property Commands commands: Commands{} property Sizes sizes: Sizes {} + + component Commands: JsonObject { + property list logout: ["loginctl", "terminate-user", ""] + property list shutdown: ["systemctl", "poweroff"] + property list hibernate: ["systemctl", "hibernate"] + property list reboot: ["systemctl", "reboot"] + } component Sizes: JsonObject { property int button: 80 diff --git a/modules/lock/Buttons.qml b/modules/lock/Buttons.qml index 66833ab..1995151 100644 --- a/modules/lock/Buttons.qml +++ b/modules/lock/Buttons.qml @@ -50,22 +50,22 @@ Item { SessionButton { icon: "logout" - command: ["loginctl", "terminate-user", ""] + command: Config.session.commands.logout } SessionButton { icon: "power_settings_new" - command: ["systemctl", "poweroff"] + command: Config.session.commands.shutdown } SessionButton { icon: "downloading" - command: ["systemctl", "hibernate"] + command: Config.session.commands.hibernate } SessionButton { icon: "cached" - command: ["systemctl", "reboot"] + command: Config.session.commands.reboot } Behavior on anchors.margins { diff --git a/modules/session/Content.qml b/modules/session/Content.qml index 2603bf9..d90c0bc 100644 --- a/modules/session/Content.qml +++ b/modules/session/Content.qml @@ -23,7 +23,7 @@ Column { id: logout icon: "logout" - command: ["loginctl", "terminate-user", ""] + command: Config.session.commands.logout KeyNavigation.down: shutdown @@ -46,7 +46,7 @@ Column { id: shutdown icon: "power_settings_new" - command: ["systemctl", "poweroff"] + command: Config.session.commands.shutdown KeyNavigation.up: logout KeyNavigation.down: hibernate @@ -68,7 +68,7 @@ Column { id: hibernate icon: "downloading" - command: ["systemctl", "hibernate"] + command: Config.session.commands.hibernate KeyNavigation.up: shutdown KeyNavigation.down: reboot @@ -78,7 +78,7 @@ Column { id: reboot icon: "cached" - command: ["systemctl", "reboot"] + command: Config.session.commands.reboot KeyNavigation.up: hibernate } -- cgit v1.2.3-freya