nix-config/lib/hyprland/gestures.nix
2025-12-04 18:08:06 +01:00

61 lines
1.5 KiB
Nix

{lib, ...}: let
inherit (lib) mkOption types;
inherit (builtins) concatStringsSep;
# v0.52.1
# gesture = fingers, direction, action, options
gesture =
types.submodule {
options = {
fingers = mkOption {
type = types.ints.positive;
};
direction = mkOption {
type = types.enum ["swipe" "horizontal" "vertical" "left" "right" "up" "down" "pinch" "pinchin" "pinchout"];
};
mods = mkOption {
type = types.listOf types.str;
default = [];
};
scale = mkOption {
type = types.numbers.positive;
default = 1;
};
action = mkOption {
type = types.enum ["dispatcher" "workspace" "move" "resize" "special" "close" "fullscreen" "float"];
};
options = mkOption {
type = types.listOf types.str;
default = [];
};
};
}
// {
};
in {
options.horseman.wm.hyprland.config = {
gestures.gestures = mkOption {
type = types.listOf gesture;
default = [];
apply = gs:
map (it:
it
// {
__toString = gs: "gesture = ${concatStringsSep ", " (
[
(toString gs.fingers)
(gs.direction)
]
++ map (it: "mod: ${it}") gs.mods
++ [
"scale: ${toString gs.scale}"
(gs.action)
]
++ gs.options
)}";
})
gs;
};
};
}