From 913a86e9c2fae05354940c468b6209143ab8a129 Mon Sep 17 00:00:00 2001 From: moons14 Date: Thu, 6 Aug 2026 19:12:54 +0900 Subject: [PATCH] fix(labwc): close only the active Ghostty tab with Mod+Q --- modules/applications/labwc/home.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/applications/labwc/home.nix b/modules/applications/labwc/home.nix index 3686107..e471ede 100644 --- a/modules/applications/labwc/home.nix +++ b/modules/applications/labwc/home.nix @@ -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 '';