quickshell: fix dead power menu — execDetached for commands, lua dispatch syntax for logout

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-06-11 19:29:49 +01:00
parent fd8a52cee8
commit d570674224

View file

@ -214,14 +214,16 @@ in
visible = false; visible = false;
} }
// Power actions go through Hyprland's exec dispatcher so they // Lock/reboot/shutdown spawn via Quickshell.execDetached fully
// are NOT children of quickshell a quickshell restart must // detached, so a quickshell restart can never kill a running
// never kill a running hyprlock. // hyprlock. Logout (empty cmd) goes through Hyprland IPC; with a
// Lua config the dispatch body is evaluated as a Lua dispatcher
// expression, so it must use hl.dsp.* syntax, not hyprlang's.
readonly property var powerActions: [ readonly property var powerActions: [
{ name: "Lock", glyph: "", dispatch: "exec " + Commands.hyprlock }, { name: "Lock", glyph: "", cmd: [Commands.hyprlock] },
{ name: "Logout", glyph: "", dispatch: "exit" }, { name: "Logout", glyph: "", cmd: [] },
{ name: "Reboot", glyph: "", dispatch: "exec " + Commands.systemctl + " reboot" }, { name: "Reboot", glyph: "", cmd: [Commands.systemctl, "reboot"] },
{ name: "Shutdown", glyph: "", dispatch: "exec " + Commands.systemctl + " poweroff" } { name: "Shutdown", glyph: "", cmd: [Commands.systemctl, "poweroff"] }
] ]
function score(name, extra, q) { function score(name, extra, q) {
@ -255,7 +257,8 @@ in
function activate(item) { function activate(item) {
if (!item) return; if (!item) return;
if (mode === "power") { if (mode === "power") {
Hyprland.dispatch(item.dispatch); if (item.cmd.length === 0) Hyprland.dispatch("hl.dsp.exit()");
else Quickshell.execDetached(item.cmd);
} else { } else {
item.execute(); item.execute();
} }