fix(labwc): close only the active Ghostty tab with Mod+Q

This commit is contained in:
2026-08-06 19:12:54 +09:00
parent 5ebcbb4abf
commit 913a86e9c2
+19 -1
View File
@@ -20,6 +20,20 @@ let
"@command" = command;
};
closeFocused = {
"@key" = "W-q";
"@onRelease" = "yes";
action = {
"@name" = "If";
query.identifier = "com.mitchellh.ghostty";
"then".action = {
"@name" = "Execute";
"@command" = "${lib.getExe' pkgs.wtype "wtype"} -M ctrl -M shift -P w -p w -m shift -m ctrl";
};
"else".action."@name" = "Close";
};
};
snapToEdge =
key: direction:
keybind key {
@@ -99,7 +113,7 @@ in
numlock = "on";
keybind = [
# labwc window management
(action "W-q" "Close")
closeFocused
(action "W-f" "ToggleMaximize")
(action "W-c" "Iconify")
(execute "W-Tab" "window-overview")
@@ -222,6 +236,10 @@ in
];
};
# Labwc's Close action closes Ghostty's whole GTK window. Route Mod+Q to
# Ghostty's current-tab action instead while keeping normal window close elsewhere.
programs.ghostty.settings.keybind = [ "ctrl+shift+w=close_tab" ];
xdg.configFile."labwc/shutdown".text = lib.mkAfter ''
${systemctl} --user stop graphical-session.target
'';