refactor(hyprland): inline directional key list

This commit is contained in:
2026-10-11 14:49:19 -04:00
parent 2d417b2144
commit 8ae256b2e5

View File

@@ -4,26 +4,6 @@
... ...
}: }:
# The Hyprland compositor. # The Hyprland compositor.
let
directions = [
{
key = "H";
direction = "left";
}
{
key = "J";
direction = "down";
}
{
key = "K";
direction = "up";
}
{
key = "L";
direction = "right";
}
];
in
{ {
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor"; options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
@@ -60,33 +40,53 @@ in
] ]
) (lib.range 1 9) ) (lib.range 1 9)
)) ))
# Generate directional keybinds. # Generate directional keybinds.
(lib.listToAttrs ( (lib.listToAttrs (
lib.concatMap ( lib.concatMap
{ direction, key }: (
{ direction, key }:
[
{
name = "hyprland-focus-${direction}";
value = {
keys = "SUPER + ${key}";
action = {
kind = "focus";
inherit direction;
};
};
}
{
name = "hyprland-move-${direction}";
value = {
keys = "SUPER + SHIFT + ${key}";
action = {
kind = "move-window";
inherit direction;
};
};
}
]
)
[ [
{ {
name = "hyprland-focus-${direction}"; key = "H";
value = { direction = "left";
keys = "SUPER + ${key}";
action = {
kind = "focus";
inherit direction;
};
};
} }
{ {
name = "hyprland-move-${direction}"; key = "J";
value = { direction = "down";
keys = "SUPER + SHIFT + ${key}"; }
action = { {
kind = "move-window"; key = "K";
inherit direction; direction = "up";
}; }
}; {
key = "L";
direction = "right";
} }
] ]
) directions
)) ))
]; ];