From 77e14968eec32d31327c2ff68bebabdfcfb8d7a8 Mon Sep 17 00:00:00 2001 From: Emma Thorpe Date: Tue, 9 Jun 2026 20:04:52 +0100 Subject: [PATCH] fix(sway): restore clobbered keybindings; update foot for 1.27 Two desktop-config fixes found together: 1. Keybindings: the previous Mod+Space launcher bind wrapped the set in `lib.mkMerge [ { ... } (mkOptionDefault ...) ]`. A normal-priority definition there wins over (and discards) the home-manager module's default keybindings, which are at mkOptionDefault priority -- so every default bind (terminal Mod+Return, movement, workspaces, kill, ...) and even the custom swaylock/volume binds silently vanished; only Mod+Space survived. That is why Super+Enter opened nothing. Restore the single mkOptionDefault wrapper (so it merges with the module defaults) and override just Mod+Space via lib.mkForce to beat the module's default focus-mode_toggle without a same-priority conflict. Generated config goes from 1 bindsym back to 57. 2. foot 1.27: the bare [colors] section is deprecated in favour of [colors-dark], and `[cursor] color` is rejected ("not a valid option: color"). Move the palette to colors-dark and set the cursor colour via its `cursor` key (" "). `foot --check-config` now passes. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyrathorpe/home/sway.nix | 53 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/lyrathorpe/home/sway.nix b/lyrathorpe/home/sway.nix index 9ba4acd..27e6772 100644 --- a/lyrathorpe/home/sway.nix +++ b/lyrathorpe/home/sway.nix @@ -120,27 +120,29 @@ in } ]; - keybindings = lib.mkMerge [ - # Bind the launcher to Mod+Space. This deliberately replaces the default - # Mod+Space (focus mode_toggle); a bare attrset (normal priority) wins - # over the module default, whereas the mkOptionDefault block below would - # only tie with it. Mod+d still runs the launcher too (module default). - { "${modifier}+space" = "exec ${menu}"; } - (lib.mkOptionDefault ( - { - "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f"; - "Print" = "exec ${pkgs.grim}/bin/grim ~/screenshot-$(date +%F-%H%M%S).png"; - "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; - "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; - "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - } - # Screen backlight: laptops only (no internal backlight on a desktop). - // lib.optionalAttrs portable { - "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; - "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; - } - )) - ]; + # NB: this whole set is wrapped in mkOptionDefault so it MERGES with the + # home-manager module's default keybindings (same priority) rather than + # replacing them. Do not wrap it in mkMerge with a normal-priority attr -- + # that makes the normal-priority def win and silently drops every default + # bind (terminal, movement, workspaces, ...). + keybindings = lib.mkOptionDefault ( + { + # Launcher on Mod+Space. mkForce overrides the module's own default + # Mod+Space (focus mode_toggle); a plain value would conflict with it + # at equal priority. Mod+d also still runs the launcher (module default). + "${modifier}+space" = lib.mkForce "exec ${menu}"; + "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f"; + "Print" = "exec ${pkgs.grim}/bin/grim ~/screenshot-$(date +%F-%H%M%S).png"; + "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; + "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; + "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + } + # Screen backlight: laptops only (no internal backlight on a desktop). + // lib.optionalAttrs portable { + "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; + "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; + } + ); }; }; @@ -148,8 +150,13 @@ in # `terminal` above still launches the same binary, now themed. programs.foot = { enable = true; + # foot 1.27: the bare [colors] section is deprecated in favour of + # [colors-dark] (the default theme), and the cursor colour moved out of + # [cursor] (where `color` is now rejected) into a `cursor` key here, written + # " " (man foot.ini(5): "ff0000 00ff00" => green cursor, red + # text). Only colors-dark is needed; we never set initial-color-theme=light. settings = { - colors = { + "colors-dark" = { background = ctp.base; foreground = ctp.text; regular0 = ctp.surface1; @@ -170,8 +177,8 @@ in bright7 = ctp.subtext0; "selection-foreground" = ctp.base; "selection-background" = ctp.rosewater; + cursor = "${ctp.base} ${ctp.rosewater}"; }; - cursor.color = "${ctp.base} ${ctp.rosewater}"; }; };