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
This commit is contained in:
Joel R. 2025-07-29 04:45:33 +02:00 committed by GitHub
parent 067b71bcbd
commit 7dc5b65d22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 9 deletions

View file

@ -223,7 +223,13 @@ All configuration options are in `~/.config/caelestia/shell.json`.
"useFahrenheit": false "useFahrenheit": false
}, },
"session": { "session": {
"dragThreshold": 30 "dragThreshold": 30,
"commands": {
"logout": ["loginctl", "terminate-user", ""],
"shutdown": ["systemctl", "poweroff"],
"hibernate": ["systemctl", "hibernate"],
"reboot": ["systemctl", "reboot"]
}
} }
} }
``` ```

View file

@ -3,8 +3,16 @@ import Quickshell.Io
JsonObject { JsonObject {
property bool enabled: true property bool enabled: true
property int dragThreshold: 30 property int dragThreshold: 30
property Commands commands: Commands{}
property Sizes sizes: Sizes {} property Sizes sizes: Sizes {}
component Commands: JsonObject {
property list<string> logout: ["loginctl", "terminate-user", ""]
property list<string> shutdown: ["systemctl", "poweroff"]
property list<string> hibernate: ["systemctl", "hibernate"]
property list<string> reboot: ["systemctl", "reboot"]
}
component Sizes: JsonObject { component Sizes: JsonObject {
property int button: 80 property int button: 80
} }

View file

@ -50,22 +50,22 @@ Item {
SessionButton { SessionButton {
icon: "logout" icon: "logout"
command: ["loginctl", "terminate-user", ""] command: Config.session.commands.logout
} }
SessionButton { SessionButton {
icon: "power_settings_new" icon: "power_settings_new"
command: ["systemctl", "poweroff"] command: Config.session.commands.shutdown
} }
SessionButton { SessionButton {
icon: "downloading" icon: "downloading"
command: ["systemctl", "hibernate"] command: Config.session.commands.hibernate
} }
SessionButton { SessionButton {
icon: "cached" icon: "cached"
command: ["systemctl", "reboot"] command: Config.session.commands.reboot
} }
Behavior on anchors.margins { Behavior on anchors.margins {

View file

@ -23,7 +23,7 @@ Column {
id: logout id: logout
icon: "logout" icon: "logout"
command: ["loginctl", "terminate-user", ""] command: Config.session.commands.logout
KeyNavigation.down: shutdown KeyNavigation.down: shutdown
@ -46,7 +46,7 @@ Column {
id: shutdown id: shutdown
icon: "power_settings_new" icon: "power_settings_new"
command: ["systemctl", "poweroff"] command: Config.session.commands.shutdown
KeyNavigation.up: logout KeyNavigation.up: logout
KeyNavigation.down: hibernate KeyNavigation.down: hibernate
@ -68,7 +68,7 @@ Column {
id: hibernate id: hibernate
icon: "downloading" icon: "downloading"
command: ["systemctl", "hibernate"] command: Config.session.commands.hibernate
KeyNavigation.up: shutdown KeyNavigation.up: shutdown
KeyNavigation.down: reboot KeyNavigation.down: reboot
@ -78,7 +78,7 @@ Column {
id: reboot id: reboot
icon: "cached" icon: "cached"
command: ["systemctl", "reboot"] command: Config.session.commands.reboot
KeyNavigation.up: hibernate KeyNavigation.up: hibernate
} }