From be9c3c07a3de19f534599780a495a1475301bc69 Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 11 Oct 2026 15:00:03 -0400 Subject: [PATCH] feat(hyprland): add window resize binds --- .../desktop/session/hyprland/default.nix | 43 ++++++++++++++++++- configs/nixos/registry/keybind.nix | 13 ++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/configs/nixos/modules/desktop/session/hyprland/default.nix b/configs/nixos/modules/desktop/session/hyprland/default.nix index b322f9d..5dee9af 100644 --- a/configs/nixos/modules/desktop/session/hyprland/default.nix +++ b/configs/nixos/modules/desktop/session/hyprland/default.nix @@ -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(${ 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} )) - ]; + ] + ++ lib.optional keybind.repeating { + repeating = true; + }; }) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind); }; }; diff --git a/configs/nixos/registry/keybind.nix b/configs/nixos/registry/keybind.nix index 198d44f..7abd253 100644 --- a/configs/nixos/registry/keybind.nix +++ b/configs/nixos/registry/keybind.nix @@ -18,6 +18,11 @@ ] && 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; message = "Desktop keybind actions must set the fields their kind requires."; } @@ -31,6 +36,13 @@ 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 { description = "Declares the action this keybind runs."; type = lib.types.submodule { @@ -41,6 +53,7 @@ "exec" "focus" "move-window" + "resize-window" ]; }; -- 2.47.3