feat(hyprland): add directional window movement binds

This commit is contained in:
2026-10-11 13:00:26 -04:00
parent a2fc568704
commit 40a3f6b1cc
2 changed files with 58 additions and 34 deletions

View File

@@ -4,6 +4,26 @@
...
}:
# 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";
@@ -24,38 +44,35 @@
))
# Generate directional keybinds.
(lib.listToAttrs (
map
(
{ direction, key }:
{
name = "hyprland-focus-${direction}";
value = {
keys = "SUPER + ${key}";
action = {
kind = "focus";
inherit direction;
};
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";
}
]
};
}
) directions
))
# Generate directional window movement keybinds.
(lib.listToAttrs (
map (
{ direction, key }:
{
name = "hyprland-move-${direction}";
value = {
keys = "SUPER + Shift + ${key}";
action = {
kind = "move-window";
inherit direction;
};
};
}
) directions
))
];
@@ -94,6 +111,9 @@
focus = "hl.dsp.focus(${
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
})";
"move-window" = "hl.dsp.window.move(${
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
})";
}
.${keybind.action.kind}
))