feat(hyprland): add window resize binds #152

Merged
alexion merged 1 commits from feat/hyprland-lua-window-resize into main 2026-10-11 16:02:39 -04:00
2 changed files with 55 additions and 1 deletions

View File

@@ -61,6 +61,17 @@
}; };
}; };
} }
{
name = "hyprland-resize-${direction}";
value = {
keys = "SUPER + ALT + ${key}";
repeating = true;
action = {
kind = "resize-window";
inherit direction;
};
};
}
] ]
) )
[ [
@@ -122,10 +133,40 @@
"move-window" = "hl.dsp.window.move(${ "move-window" = "hl.dsp.window.move(${
lib.generators.toLua { } { inherit (keybind.action) direction workspace; } lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
})"; })";
"resize-window" = "hl.dsp.window.resize(${
lib.generators.toLua { } (
{
down = {
x = 0;
y = 10;
relative = true;
};
left = {
x = -10;
y = 0;
relative = true;
};
right = {
x = 10;
y = 0;
relative = true;
};
up = {
x = 0;
y = -10;
relative = true;
};
}
.${keybind.action.direction}
)
})";
} }
.${keybind.action.kind} .${keybind.action.kind}
)) ))
]; ]
++ lib.optional keybind.repeating {
repeating = true;
};
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind); }) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);
}; };
}; };

View File

@@ -18,6 +18,11 @@
] ]
&& lib.xor (entry.value.action.direction != null) (entry.value.action.workspace != null) && lib.xor (entry.value.action.direction != null) (entry.value.action.workspace != null)
) )
|| (
entry.value.action.kind == "resize-window"
&& entry.value.action.direction != null
&& entry.value.action.workspace == null
)
) entries; ) entries;
message = "Desktop keybind actions must set the fields their kind requires."; message = "Desktop keybind actions must set the fields their kind requires.";
} }
@@ -31,6 +36,13 @@
example = "SUPER + Return"; example = "SUPER + Return";
}; };
repeating = lib.mkOption {
description = "Repeats the keybind action while the key chord is held.";
type = lib.types.bool;
default = false;
example = true;
};
action = lib.mkOption { action = lib.mkOption {
description = "Declares the action this keybind runs."; description = "Declares the action this keybind runs.";
type = lib.types.submodule { type = lib.types.submodule {
@@ -41,6 +53,7 @@
"exec" "exec"
"focus" "focus"
"move-window" "move-window"
"resize-window"
]; ];
}; };