From 07d5bffef2be6fac4893c26fc42417113114c817 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 26 Aug 2026 16:31:26 -0400 Subject: [PATCH] hyprland fixes --- configs/fwbook/hypr/conf/animations.lua | 14 +++- configs/fwbook/hypr/conf/hyprgrass.lua | 97 +++++++++++++++--------- configs/fwbook/hypr/hyprland.lua | 2 +- modules/nixos/desktop/tiler/hyprland.nix | 8 ++ 4 files changed, 81 insertions(+), 40 deletions(-) diff --git a/configs/fwbook/hypr/conf/animations.lua b/configs/fwbook/hypr/conf/animations.lua index 581ca9a..b98ad06 100644 --- a/configs/fwbook/hypr/conf/animations.lua +++ b/configs/fwbook/hypr/conf/animations.lua @@ -8,6 +8,16 @@ -- hl.animation requires an explicit bezier/spring (there is no built-in -- "default" curve name in the Lua API), so define one first. -hl.curve("wsslide", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.0 } } }) +hl.curve("wsslide", { + type = "bezier", + points = { { 0.05, 0.9 }, { 0.1, 1.0 } }, +}) -hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "wsslide", style = "slidevert" }) + +hl.animation({ + leaf = "workspaces", + enabled = true, + speed = 2, + bezier = "wsslide", + style = "slidevert", +}) diff --git a/configs/fwbook/hypr/conf/hyprgrass.lua b/configs/fwbook/hypr/conf/hyprgrass.lua index 50460e5..4e8c8ce 100644 --- a/configs/fwbook/hypr/conf/hyprgrass.lua +++ b/configs/fwbook/hypr/conf/hyprgrass.lua @@ -2,42 +2,65 @@ -- Hyprgrass (Touchpad Gestures) -- ========================= -- Hyprgrass plugin configuration for advanced touchpad gesture support. --- Handles swipes, taps, and other multi-finger gestures on the touchpad. -- Documentation: https://github.com/horriblename/hyprgrass +-- Config reference: docs/configuration.md -hl.config({ - plugin = { - hyprgrass = { - -- Bind gestures to workspace switching (4-finger swipes) - bind = { - "SUPER, swipe:4:left, workspace, +1", - "SUPER, swipe:4:right, workspace, -1", - - -- Hold modifier + gesture for special actions - "ALT, swipe:4:up, exec, rofi -show", - "ALT, swipe:4:down, exec, rofi -show window", - }, - - -- Bind movements (e.g., drag to move windows) - bindm = { - -- 3-finger drag to move windows (alternative to Super+drag) - "SUPER, swipe:3:left, movewindow, l", - "SUPER, swipe:3:right, movewindow, r", - "SUPER, swipe:3:up, movewindow, u", - "SUPER, swipe:3:down, movewindow, d", - }, - - -- Sensitivity and behavior settings - sensitivity = 4.0, - long_press_delay = 400, - - -- Gesture deadzone (in pixels) - edges = { - top = 10, - bottom = 10, - left = 10, - right = 10, - }, - } - } -}) +-- environment.systemPackages only puts libhyprgrass.so on disk -- Hyprland +-- doesn't load plugins on its own. HYPRGRASS_SO is set in +-- modules/nixos/desktop/tiler/hyprland.nix (sessionVariables) to the resolved +-- store path, since that path changes on every flake update. Must run before +-- anything below references plugin.hyprgrass config keys or hl.plugin.hyprgrass, +-- both of which only exist once the plugin is loaded. +hl.plugin.load(os.getenv("HYPRGRASS_SO")) + +-- hl.config({ +-- plugin = { +-- hyprgrass = { +-- -- The default sensitivity is probably too low on tablet screens, +-- -- I recommend turning it up to 4.0 +-- sensitivity = 4.0, + +-- -- in milliseconds +-- long_press_delay = 400, + +-- -- resize windows by long-pressing on window borders and gaps. +-- resize_on_border_long_press = true, + +-- -- in pixels, the distance from the edge that is considered an edge +-- edge_margin = 10, +-- } +-- } +-- }) + +-- -- -- ========================= +-- -- -- Custom gesture bindings +-- -- -- ========================= + +-- -- -- 4-finger swipes to switch workspaces +-- hl.plugin.hyprgrass.gesture { +-- pattern = { kind = "swipe", fingers = 4, direction = "left" }, +-- action = "workspace", +-- } +-- hl.plugin.hyprgrass.gesture { +-- pattern = { kind = "swipe", fingers = 4, direction = "right" }, +-- action = "workspace", +-- } + +-- -- 3-finger swipe down to close the focused window +-- hl.plugin.hyprgrass.gesture { +-- pattern = { kind = "swipe", fingers = 3, direction = "down" }, +-- action = "close", +-- } + +-- -- 3-finger tap to toggle floating +-- hl.plugin.hyprgrass.bind { +-- pattern = { kind = "tap", fingers = 3 }, +-- action = hl.dsp.window.float(), +-- } + +-- -- Long-press with 3 fingers to drag the focused window +-- hl.plugin.hyprgrass.bind { +-- pattern = { kind = "longpress", fingers = 3 }, +-- action = hl.dsp.window.drag(), +-- mouse = true, +-- } diff --git a/configs/fwbook/hypr/hyprland.lua b/configs/fwbook/hypr/hyprland.lua index 9d6120a..4dfee34 100644 --- a/configs/fwbook/hypr/hyprland.lua +++ b/configs/fwbook/hypr/hyprland.lua @@ -15,7 +15,7 @@ require("conf/general") require("conf/animations") require("conf/monitors") require("conf/inputs") --- require("conf/hyprgrass") require("conf/window-rules") require("conf/keybindings") require("conf/autostart") +require("conf/hyprgrass") diff --git a/modules/nixos/desktop/tiler/hyprland.nix b/modules/nixos/desktop/tiler/hyprland.nix index 10bc585..ac95bdf 100644 --- a/modules/nixos/desktop/tiler/hyprland.nix +++ b/modules/nixos/desktop/tiler/hyprland.nix @@ -59,6 +59,14 @@ in hyprgrass.packages.${system}.hyprgrass ]; + # Resolved store path for the hyprgrass plugin .so, read by + # configs/fwbook/hypr/conf/hyprgrass.lua via os.getenv to call + # hl.plugin.load(...). Adding the package to systemPackages above only + # puts the file on disk -- Hyprland needs an explicit load call, and the + # store path changes on every flake update so it can't be hardcoded there. + environment.sessionVariables.HYPRGRASS_SO = + "${hyprgrass.packages.${system}.hyprgrass}/lib/libhyprgrass.so"; + # Symlink ~/.config/hypr -> configs//hypr (host-specific). system.userActivationScripts.hyprlandConfig.text = skygUtils.makeHyperlinkScriptToConfigs { filePath = "${cfg.configName}/hypr";