refactor(hyprland): loop directional keybinds

This commit is contained in:
2026-10-11 12:54:31 -04:00
parent faf1c6e4f3
commit e18d8a9ca4

View File

@@ -9,6 +9,7 @@
config = lib.mkIf config.modules.desktop.session.hyprland.enable { config = lib.mkIf config.modules.desktop.session.hyprland.enable {
registry.keybind.${config.networking.hostName} = lib.mkMerge [ registry.keybind.${config.networking.hostName} = lib.mkMerge [
# Generate numeric workspace focus keybinds.
(lib.listToAttrs ( (lib.listToAttrs (
map (workspace: { map (workspace: {
name = "hyprland-workspace-${toString workspace}"; name = "hyprland-workspace-${toString workspace}";
@@ -21,39 +22,41 @@
}; };
}) (lib.range 1 9) }) (lib.range 1 9)
)) ))
{ # Generate directional focus keybinds from Vim movement keys.
hyprland-focus-left = { (lib.listToAttrs (
keys = "SUPER + H"; map
action = { (
kind = "focus"; { direction, key }:
direction = "left"; {
}; name = "hyprland-focus-${direction}";
}; value = {
keys = "SUPER + ${key}";
hyprland-focus-down = { action = {
keys = "SUPER + J"; kind = "focus";
action = { inherit direction;
kind = "focus"; };
direction = "down"; };
}; }
}; )
[
hyprland-focus-up = { {
keys = "SUPER + K"; key = "H";
action = { direction = "left";
kind = "focus"; }
direction = "up"; {
}; key = "J";
}; direction = "down";
}
hyprland-focus-right = { {
keys = "SUPER + L"; key = "K";
action = { direction = "up";
kind = "focus"; }
direction = "right"; {
}; key = "L";
}; direction = "right";
} }
]
))
]; ];
# This program integration owns the session, portals, and polkit, launched # This program integration owns the session, portals, and polkit, launched