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