From acebeaf180a8f5242f732c7fc9fed973fdbf30d4 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Wed, 26 Aug 2026 14:08:28 +0200 Subject: [PATCH] hyprland: Migrate config to Lua, bump back to current Hyprland 0.56.x dropped the hyprlang (.conf) config backend in favor of Lua-only config. Switch configType to "lua" and rewrite monitors, workspace/window rules, binds, env vars, and autostart using the new hl.* dispatcher API. Un-pin the hyprland flake input (back to current, following root nixpkgs) now that the config no longer depends on the old hyprlang backend. Every module that injects Hyprland keybinds (foot, wezterm, bemenu, music, light, sound, screenshot, physlock, hyprlock) is converted to the same Lua bind syntax, since the config is all-or-nothing per configType. hyprlock's swayidle dpms toggle and the hyprland-monitors hotplug script's hyprctl dispatch calls are updated to the new hl.dsp.* expression syntax the same way. One behavior change: hl.workspace_rule keeps only the last monitor set per workspace (unlike hyprlang's rule list), so workspaces that used to declare two candidate monitors now declare one static default; the hyprland-monitors service still re-dispatches the correct monitor on startup and hotplug. --- flake.lock | 109 +++--- flake.nix | 5 +- hosts/pinwheel/modules/bemenu/default.nix | 9 +- hosts/pinwheel/modules/foot/default.nix | 7 +- hosts/pinwheel/modules/hyprland/default.nix | 355 +++++++++++++----- hosts/pinwheel/modules/hyprlock/default.nix | 28 +- hosts/pinwheel/modules/light/default.nix | 14 +- hosts/pinwheel/modules/music/default.nix | 21 +- hosts/pinwheel/modules/physlock/default.nix | 16 +- hosts/pinwheel/modules/screenshot/default.nix | 14 +- hosts/pinwheel/modules/sound/default.nix | 15 +- hosts/pinwheel/modules/wezterm/default.nix | 7 +- 12 files changed, 414 insertions(+), 186 deletions(-) diff --git a/flake.lock b/flake.lock index 10c2e9e..f126f18 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1782073106, - "narHash": "sha256-dnS5SaZlPqR1E0dPXaPc+lFkBwLUbAgbwsVMk7uA6dY=", + "lastModified": 1787400831, + "narHash": "sha256-H3MEkFDZf+UH+QrVgW8TdKrssPFltF8fBg/rh0J1zIc=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "6d6e2384f381def4ea4ea81543cba4bbdac72457", + "rev": "7ce889cb78b97979b83a4648509fc3ef405c3286", "type": "github" }, "original": { @@ -280,11 +280,11 @@ ] }, "locked": { - "lastModified": 1776511930, - "narHash": "sha256-fCpwFiTW0rT7oKJqr3cqHMnkwypSwQKpbtUEtxdkgrM=", + "lastModified": 1786464181, + "narHash": "sha256-2alOMkLjXANh7unkZnYnCF2K2rApZaOLMoQ3o+VX2CY=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "39435900785d0c560c6ae8777d29f28617d031ef", + "rev": "e4ed7c08123df5af460a0a70961380cbfb872f76", "type": "github" }, "original": { @@ -309,11 +309,11 @@ ] }, "locked": { - "lastModified": 1782566056, - "narHash": "sha256-haEZcHzYrePnjFOYSWTbxm/Nrla0aPslJfmvdCvqtVc=", + "lastModified": 1786464367, + "narHash": "sha256-k58p4wbzIXWyRWrW84pP8tD+iaZSSYiiM+fr0Auk4oU=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "c6e7b9f673f4360bc813d3dc75028f75ee88d3f8", + "rev": "7c895c44e3ca6d28ed68ddd80ec02b02b925e7fc", "type": "github" }, "original": { @@ -333,23 +333,24 @@ "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", "hyprwire": "hyprwire", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "pre-commit-hooks": "pre-commit-hooks", "systems": "systems_2", "xdph": "xdph" }, "locked": { - "lastModified": 1784043142, - "narHash": "sha256-vd4VSlddmDAToJv/twyr0O8Siq4U/sOIXeo6DFZIolc=", + "lastModified": 1787612295, + "narHash": "sha256-K7sUeS1tKTSDu+aQK0ZwCxJCls+JzDj1qeTJRGk+CV8=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "79bc0ca16e7cca40c247a9200634d150fa8193d1", + "rev": "0bd11c7a04a63d2785abd53363f09d552175d67d", "type": "github" }, "original": { "owner": "hyprwm", "repo": "Hyprland", - "rev": "79bc0ca16e7cca40c247a9200634d150fa8193d1", "type": "github" } }, @@ -406,11 +407,11 @@ ] }, "locked": { - "lastModified": 1782563850, - "narHash": "sha256-rs/EzgrgPHbCtJjFZN4aR1HYldH/0NtGAempWVpWQTs=", + "lastModified": 1786464504, + "narHash": "sha256-7sHwM86KILQyHDHDuE2SDBlQ2jvZ0EW3hY7sW009/cg=", "owner": "hyprwm", "repo": "hyprland-guiutils", - "rev": "5ba080ee036c30cb2485f2647ff8a61f7aa08178", + "rev": "4c30cf3097ea963c0e250749ee0c59f8b08816d6", "type": "github" }, "original": { @@ -460,11 +461,11 @@ ] }, "locked": { - "lastModified": 1777320127, - "narHash": "sha256-Qu+Wf2Bp5qUjyn2YpZNq8a7JyzTGowhT1knrwE38a9U=", + "lastModified": 1786464129, + "narHash": "sha256-339AkTlpMYSIvFuG0rnR+8Yg4/AZKeJalshJavlnKfg=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "090117506ddc3d7f26e650ff344d378c2ec329cc", + "rev": "9508458be316a0d70d37ebed1ab725ccd10411ff", "type": "github" }, "original": { @@ -512,11 +513,11 @@ ] }, "locked": { - "lastModified": 1782554491, - "narHash": "sha256-+p3MlyN/nqRefcf2IckPlGRUn9+hielqpS9XClbLleM=", + "lastModified": 1785930473, + "narHash": "sha256-DitTu625BhEYpZjtjxtGpjrEJwPwW+X/+jJvhSZNSJM=", "owner": "hyprwm", "repo": "hyprtoolkit", - "rev": "bdba25ced39ea39ab004a8f31593ba0b0ff1ca35", + "rev": "af515b69dfbe366dc7873aa1475cb2f4db3ebad7", "type": "github" }, "original": { @@ -537,11 +538,11 @@ ] }, "locked": { - "lastModified": 1783002634, - "narHash": "sha256-xGqHIUK0wIZoW7SiMalwvO6uGOO/VrlQwoRobpE7dDI=", + "lastModified": 1786903207, + "narHash": "sha256-QTwMqLLONRhv9iz6CVeuX6BqQNQCIqI8hL/cPYlR/24=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "41fb809557abd29a57151b6e1aaeabd05f9437e1", + "rev": "6cf50415e06dc6bd9f1252f1b745eac6b4a1cc39", "type": "github" }, "original": { @@ -562,11 +563,11 @@ ] }, "locked": { - "lastModified": 1777159683, - "narHash": "sha256-Jxixw6wZphUp+nHYxOKUYSckL17QMBx2d5Zp0rJHr1g=", + "lastModified": 1786464033, + "narHash": "sha256-QM8Qe4/L8lpdVN4bgwahmi+jyyc4fisseDMe4afcDxA=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "b8632713a6beaf28b56f2a7b0ab2fb7088dbb404", + "rev": "62e62c1ca23da17612c6890d4ad2064f575643db", "type": "github" }, "original": { @@ -591,11 +592,11 @@ ] }, "locked": { - "lastModified": 1778410714, - "narHash": "sha256-o6RzFj4nJXaPRY7EM01siuCQeT41RfwwmcmFQqwFJJg=", + "lastModified": 1786464294, + "narHash": "sha256-ZQsZ2WvBdkboCIyh8LStDPdAIARmxzn0XMNxxoOhjPE=", "owner": "hyprwm", "repo": "hyprwire", - "rev": "85148a8e612808cf5ddb25d0b3c5840f3498a7dc", + "rev": "4ce7cd6b6128c1ac41caf23c58a30a26b327f9dd", "type": "github" }, "original": { @@ -691,7 +692,7 @@ }, "nh": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1773920367, @@ -747,7 +748,7 @@ }, "nixos-hardware": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1786867632, @@ -766,16 +767,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1783522502, - "narHash": "sha256-iffAls3iaNTyJC2faYcUXSI+Gp02cDjYl+MygxKl2GI=", + "lastModified": 1772822230, + "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0bb7ec54c8483066ec9d7720e780a5caa71f8612", + "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-25.11", "repo": "nixpkgs", "type": "github" } @@ -797,22 +798,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1772822230, - "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-25.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1767892417, "narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=", @@ -825,7 +810,7 @@ "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1786862985, "narHash": "sha256-FBJRXmbGXiSUDvYEbfLYRkckayyZ6SK1UEqhCrIZ2Cs=", @@ -871,11 +856,11 @@ ] }, "locked": { - "lastModified": 1783008725, - "narHash": "sha256-jGiy6+sxjNWXSjp25uoJuNfyH9zBK1PEDY0lVoL4ibQ=", + "lastModified": 1784288435, + "narHash": "sha256-ReRHaLgr/uVqdD8afFSn+myXIfpHeOhP0yYe0TJqAA8=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "bca82caa46d5ec0f5d422c61fb1e30bc51313cbe", + "rev": "43b3c1ab9d40fb1dbb008f451988a91e375825e9", "type": "github" }, "original": { @@ -922,7 +907,7 @@ "nix-gc-env": "nix-gc-env", "nix-jetbrains-plugins": "nix-jetbrains-plugins", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "pppdotpm-site": "pppdotpm-site", "puppy-tracker": "puppy-tracker", "solo-referee": "solo-referee", @@ -1149,11 +1134,11 @@ ] }, "locked": { - "lastModified": 1782644412, - "narHash": "sha256-/iSa/bL1QQFLv+uJ9gI0N87J8gOeZXvca7EjoPGKE6w=", + "lastModified": 1786988229, + "narHash": "sha256-frEFLVRj8xXvBBDs44IRiqHo6R2PxsRpluygL7abjjI=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "c01c99fc278ec68c82e9865923088f043c7c1621", + "rev": "59d429bf45aed4e2209043c0c36565ad8e2859a5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 61d6d98..0b5e4b2 100644 --- a/flake.nix +++ b/flake.nix @@ -33,9 +33,8 @@ }; hyprland = { - # Pinned pre-0.56.0: 0.56.0 dropped the hyprlang (.conf) config - # backend in favor of Lua-only config. Bump once migrated. - url = "github:hyprwm/Hyprland/79bc0ca16e7cca40c247a9200634d150fa8193d1"; + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; }; hyprland-contrib = { diff --git a/hosts/pinwheel/modules/bemenu/default.nix b/hosts/pinwheel/modules/bemenu/default.nix index e2ace13..31ff927 100644 --- a/hosts/pinwheel/modules/bemenu/default.nix +++ b/hosts/pinwheel/modules/bemenu/default.nix @@ -28,7 +28,14 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { - bind = [ "$mod, SPACE, exec, ${bmr}" ]; + bind = [ + { + _args = [ + "SUPER + SPACE" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${bmr}")'') + ]; + } + ]; }; }; }; diff --git a/hosts/pinwheel/modules/foot/default.nix b/hosts/pinwheel/modules/foot/default.nix index fb86c27..6de4bbc 100644 --- a/hosts/pinwheel/modules/foot/default.nix +++ b/hosts/pinwheel/modules/foot/default.nix @@ -33,7 +33,12 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ - "$mod, RETURN, exec, ${pkgs.foot}/bin/foot" + { + _args = [ + "SUPER + RETURN" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.foot}/bin/foot")'') + ]; + } ]; }; }; diff --git a/hosts/pinwheel/modules/hyprland/default.nix b/hosts/pinwheel/modules/hyprland/default.nix index c42a466..2df46c5 100644 --- a/hosts/pinwheel/modules/hyprland/default.nix +++ b/hosts/pinwheel/modules/hyprland/default.nix @@ -8,6 +8,8 @@ let enabled = config.mod.hyprland.enable; + mod = "SUPER"; + monitorScript = pkgs.writeShellScript "hyprland-monitor-handler" '' INTERNAL="eDP-1" EXTERNAL_MONITORS="HDMI-A-1 DP-3" @@ -31,15 +33,15 @@ let if external=$(get_active_external); then # External monitor connected: move workspaces 1-5 to external, 6-10 to internal for ws in 1 2 3 4 5; do - batch="$batch dispatch moveworkspacetomonitor $ws $external;" + batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$external\", workspace = $ws });" done for ws in 6 7 8 9 10; do - batch="$batch dispatch moveworkspacetomonitor $ws $INTERNAL;" + batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$INTERNAL\", workspace = $ws });" done else # No external monitor: move all workspaces to internal for ws in 1 2 3 4 5 6 7 8 9 10; do - batch="$batch dispatch moveworkspacetomonitor $ws $INTERNAL;" + batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$INTERNAL\", workspace = $ws });" done fi @@ -97,91 +99,180 @@ in wayland.windowManager.hyprland = { enable = true; systemd.enable = false; - configType = "hyprlang"; - - extraConfig = '' - exec-once = uwsm app -- waybar - exec-once = uwsm app -- hyprctl setcursor Adwaita 24 - - env = GDK_DPI_SCALE,1.5 - env = HYPRCURSOR_THEME,Adwaita - env = HYPRCURSOR_SIZE,24 - - monitor=eDP-1, 1920x1200, auto-center-down, 1 - monitor=HDMI-A-1, 2560x1440@100, auto-center-up, 1 - monitor=DP-3, 2560x1440@60, auto-center-up, 1 - - # Workspaces 1-5 on external monitors (HDMI-A-1 or DP-3) - workspace = 1, monitor:HDMI-A-1, default:true - workspace = 2, monitor:HDMI-A-1 - workspace = 3, monitor:HDMI-A-1 - workspace = 4, monitor:HDMI-A-1 - workspace = 5, monitor:HDMI-A-1 - workspace = 1, monitor:DP-3, default:true - workspace = 2, monitor:DP-3 - workspace = 3, monitor:DP-3 - workspace = 4, monitor:DP-3 - workspace = 5, monitor:DP-3 - - # Workspaces 6-10 on internal monitor - workspace = 6, monitor:eDP-1, default:true - workspace = 7, monitor:eDP-1 - workspace = 8, monitor:eDP-1 - workspace = 9, monitor:eDP-1 - workspace = 10, monitor:eDP-1 - - workspace = w[tv1], gapsout:0, gapsin:0 - workspace = f[1], gapsout:0, gapsin:0 - windowrule = border_size 0, match:float 0, match:workspace w[tv1] - windowrule = rounding 0, match:float 0, match:workspace w[tv1] - windowrule = border_size 0, match:float 0, match:workspace f[1] - windowrule = rounding 0, match:float 0, match:workspace f[1] - - # https://wiki.archlinux.org/title/Hyprland#Jetbrains_apps_focus_issues - windowrule = match:xwayland true, no_initial_focus on - - ''; + configType = "lua"; settings = { - "$mod" = "SUPER"; + config = { + xwayland.force_zero_scaling = true; - animations.enabled = false; + input = { + kb_layout = "se"; - xwayland = { - force_zero_scaling = true; - }; + # 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. + follow_mouse = 2; - input = { - kb_layout = "se"; - - # 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. - follow_mouse = 2; - - sensitivity = 0.3; - accel_profile = "flat"; - touchpad = { - natural_scroll = false; - tap-and-drag = false; + sensitivity = 0.3; + accel_profile = "flat"; + touchpad = { + natural_scroll = false; + tap_and_drag = false; + }; }; + + cursor = { + zoom_factor = 1; + zoom_rigid = true; + }; + + general = { + layout = "dwindle"; + + gaps_in = 0; # gaps between windows + gaps_out = 0; # gaps between windows and monitor edges + + col = { + active_border = "rgba(${config.lib.colors.foreground}ff)"; + inactive_border = "rgba(${config.lib.colors.background}ff)"; + }; + }; + + dwindle.force_split = 2; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + + animations.enabled = false; }; - cursor = { - zoom_factor = 1; - zoom_rigid = true; - }; + monitor = [ + { + output = "eDP-1"; + mode = "1920x1200"; + position = "auto-center-down"; + scale = "1"; + } + { + output = "HDMI-A-1"; + mode = "2560x1440@100"; + position = "auto-center-up"; + scale = "1"; + } + { + output = "DP-3"; + mode = "2560x1440@60"; + position = "auto-center-up"; + scale = "1"; + } + ]; - general = { - layout = "dwindle"; + # Static defaults only: a workspace can only have one `monitor` in + # hl.workspace_rule (later calls overwrite it, unlike hyprlang's + # rule list). The hyprland-monitors service re-dispatches these to + # whichever external monitor is actually connected at startup and + # on hotplug, so this only matters for the brief window before it + # runs. + workspace_rule = [ + { + workspace = "1"; + monitor = "HDMI-A-1"; + default = true; + } + { + workspace = "2"; + monitor = "HDMI-A-1"; + } + { + workspace = "3"; + monitor = "HDMI-A-1"; + } + { + workspace = "4"; + monitor = "HDMI-A-1"; + } + { + workspace = "5"; + monitor = "HDMI-A-1"; + } - gaps_in = 0; # gaps between windows - gaps_out = 0; # gaps between windows and monitor edges + { + workspace = "6"; + monitor = "eDP-1"; + default = true; + } + { + workspace = "7"; + monitor = "eDP-1"; + } + { + workspace = "8"; + monitor = "eDP-1"; + } + { + workspace = "9"; + monitor = "eDP-1"; + } + { + workspace = "10"; + monitor = "eDP-1"; + } - "col.active_border" = "rgba(${config.lib.colors.foreground}ff)"; - "col.inactive_border" = "rgba(${config.lib.colors.background}ff)"; - }; + { + workspace = "w[tv1]"; + gaps_out = 0; + gaps_in = 0; + } + { + workspace = "f[1]"; + gaps_out = 0; + gaps_in = 0; + } + ]; - dwindle = { - force_split = 2; + window_rule = [ + { + name = "no-gaps-wtv1"; + match = { + float = false; + workspace = "w[tv1]"; + }; + border_size = 0; + rounding = 0; + } + { + name = "no-gaps-f1"; + match = { + float = false; + workspace = "f[1]"; + }; + border_size = 0; + rounding = 0; + } + { + # https://wiki.archlinux.org/title/Hyprland#Jetbrains_apps_focus_issues + name = "xwayland-no-initial-focus"; + match.xwayland = true; + no_initial_focus = true; + } + ]; + + env = [ + { _args = [ "GDK_DPI_SCALE" "1.5" ]; } + { _args = [ "HYPRCURSOR_THEME" "Adwaita" ]; } + { _args = [ "HYPRCURSOR_SIZE" "24" ]; } + ]; + + on = { + _args = [ + "hyprland.start" + (lib.generators.mkLuaInline '' + function() + hl.exec_cmd("uwsm app -- waybar") + hl.exec_cmd("uwsm app -- hyprctl setcursor Adwaita 24") + end + '') + ]; }; bind = @@ -193,10 +284,23 @@ in in builtins.toString n; - select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; - move = builtins.genList ( - x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}" - ) 10; + focusWs = x: { + _args = [ + "${mod} + ${ws x}" + (lib.generators.mkLuaInline "hl.dsp.focus({ workspace = ${builtins.toString (x + 1)} })") + ]; + }; + moveToWs = x: { + _args = [ + "${mod} + SHIFT + ${ws x}" + (lib.generators.mkLuaInline + "hl.dsp.window.move({ workspace = ${builtins.toString (x + 1)}, follow = false })" + ) + ]; + }; + + select = builtins.genList focusWs 10; + move = builtins.genList moveToWs 10; magnifier = pkgs.writeShellScript "magnifier" '' CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float) @@ -219,31 +323,88 @@ in select ++ move ++ [ - "$mod, ESCAPE, killactive" + { + _args = [ + "${mod} + ESCAPE" + (lib.generators.mkLuaInline "hl.dsp.window.close()") + ]; + } - "$mod, f, fullscreen, 1" - "$mod SHIFT, f, togglefloating, active" + { + _args = [ + "${mod} + f" + (lib.generators.mkLuaInline ''hl.dsp.window.fullscreen({ mode = "maximized" })'') + ]; + } + { + _args = [ + "${mod} + SHIFT + f" + (lib.generators.mkLuaInline ''hl.dsp.window.float({ action = "toggle" })'') + ]; + } - "$mod, h, movefocus, l" - "$mod, j, movefocus, d" - "$mod, k, movefocus, u" - "$mod, l, movefocus, r" + { + _args = [ + "${mod} + h" + (lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "left" })'') + ]; + } + { + _args = [ + "${mod} + j" + (lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "down" })'') + ]; + } + { + _args = [ + "${mod} + k" + (lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "up" })'') + ]; + } + { + _args = [ + "${mod} + l" + (lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "right" })'') + ]; + } - "$mod CONTROL, 1, exec, ${magnifier} --increase" - "$mod CONTROL, 2, exec, ${magnifier} --decrease" - "$mod CONTROL, 3, exec, ${magnifier} --reset" + { + _args = [ + "${mod} + CONTROL + 1" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --increase")'') + ]; + } + { + _args = [ + "${mod} + CONTROL + 2" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --decrease")'') + ]; + } + { + _args = [ + "${mod} + CONTROL + 3" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --reset")'') + ]; + } ]; bindm = [ # mouse movements - "$mod, mouse:272, movewindow" # left click - "$mod, mouse:273, resizewindow" # right click + { + _args = [ + "${mod} + mouse:272" # left click + (lib.generators.mkLuaInline "hl.dsp.window.drag()") + { mouse = true; } + ]; + } + { + _args = [ + "${mod} + mouse:273" # right click + (lib.generators.mkLuaInline "hl.dsp.window.resize()") + { mouse = true; } + ]; + } ]; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - }; }; }; diff --git a/hosts/pinwheel/modules/hyprlock/default.nix b/hosts/pinwheel/modules/hyprlock/default.nix index 8937e9c..45fc591 100644 --- a/hosts/pinwheel/modules/hyprlock/default.nix +++ b/hosts/pinwheel/modules/hyprlock/default.nix @@ -59,17 +59,37 @@ in pause-music = "${pkgs.playerctl}/bin/playerctl -a pause"; dpmsTimeout = config.mod.hyprlock.dpmsTimeout; + + dpmsOff = pkgs.writeShellScript "dpms-off" '' + ${pkgs.hyprland}/bin/hyprctl dispatch 'hl.dsp.dpms({ action = "off" })' + ''; + dpmsOn = pkgs.writeShellScript "dpms-on" '' + ${pkgs.hyprland}/bin/hyprctl dispatch 'hl.dsp.dpms({ action = "on" })' + ''; + dpms-lock = pkgs.writeShellScript "dpms-lock" '' ${pkgs.swayidle}/bin/swayidle \ - timeout ${dpmsTimeout} "${pkgs.hyprland}/bin/hyprctl dispatch dpms off" \ - resume "${pkgs.hyprland}/bin/hyprctl dispatch dpms on" & + timeout ${dpmsTimeout} ${dpmsOff} \ + resume ${dpmsOn} & ${pkgs.hyprlock}/bin/hyprlock; ${pkgs.procps}/bin/pkill swayidle ''; in [ - "$mod, x, exec, ${pause-music}; ${dpms-lock}" - "$mod SHIFT, x, exec, ${pause-music}; ${pkgs.hyprlock}/bin/hyprlock & sleep 0.5; systemctl suspend" + { + _args = [ + "SUPER + x" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pause-music}; ${dpms-lock}")'') + ]; + } + { + _args = [ + "SUPER + SHIFT + x" + (lib.generators.mkLuaInline + ''hl.dsp.exec_cmd("${pause-music}; ${pkgs.hyprlock}/bin/hyprlock & sleep 0.5; systemctl suspend")'' + ) + ]; + } ]; }; }; diff --git a/hosts/pinwheel/modules/light/default.nix b/hosts/pinwheel/modules/light/default.nix index 70b19d4..9b19b1a 100644 --- a/hosts/pinwheel/modules/light/default.nix +++ b/hosts/pinwheel/modules/light/default.nix @@ -14,8 +14,18 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ - ", XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set +5%" - ", XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 5%-" + { + _args = [ + "XF86MonBrightnessUp" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.brightnessctl}/bin/brightnessctl set +5%")'') + ]; + } + { + _args = [ + "XF86MonBrightnessDown" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.brightnessctl}/bin/brightnessctl set 5%-")'') + ]; + } ]; }; }; diff --git a/hosts/pinwheel/modules/music/default.nix b/hosts/pinwheel/modules/music/default.nix index 73fd342..194527d 100644 --- a/hosts/pinwheel/modules/music/default.nix +++ b/hosts/pinwheel/modules/music/default.nix @@ -16,16 +16,23 @@ in let prev = "${pkgs.playerctl}/bin/playerctl -p naviterm,spotify previous"; next = "${pkgs.playerctl}/bin/playerctl -p naviterm,spotify next"; + + mkExec = key: cmd: { + _args = [ + key + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${cmd}")'') + ]; + }; in [ - ", XF86AudioPrev, exec, ${prev}" - ", XF86AudioNext, exec, ${next}" - ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl -p naviterm,spotify play-pause" - ", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl -p naviterm,spoitfy play-pause" + (mkExec "XF86AudioPrev" prev) + (mkExec "XF86AudioNext" next) + (mkExec "XF86AudioPlay" "${pkgs.playerctl}/bin/playerctl -p naviterm,spotify play-pause") + (mkExec "XF86AudioPause" "${pkgs.playerctl}/bin/playerctl -p naviterm,spoitfy play-pause") - "$mod ALT, LEFT, exec, ${prev}" - "$mod ALT, RIGHT, exec, ${next}" - "$mod ALT, DOWN, exec, ${pkgs.playerctl}/bin/playerctl -p naviterm,spotify play-pause" + (mkExec "SUPER + ALT + LEFT" prev) + (mkExec "SUPER + ALT + RIGHT" next) + (mkExec "SUPER + ALT + DOWN" "${pkgs.playerctl}/bin/playerctl -p naviterm,spotify play-pause") ]; }; }; diff --git a/hosts/pinwheel/modules/physlock/default.nix b/hosts/pinwheel/modules/physlock/default.nix index 5c7473e..af1656a 100644 --- a/hosts/pinwheel/modules/physlock/default.nix +++ b/hosts/pinwheel/modules/physlock/default.nix @@ -38,8 +38,20 @@ in in [ # will lock the screen with `physlock`, see `lockOn.suspend - "$mod SHIFT, x, exec, ${pause-music}; systemctl suspend" - "$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m" + { + _args = [ + "SUPER + SHIFT + x" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pause-music}; systemctl suspend")'') + ]; + } + { + _args = [ + "SUPER + x" + (lib.generators.mkLuaInline + ''hl.dsp.exec_cmd("${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m")'' + ) + ]; + } ]; }; }; diff --git a/hosts/pinwheel/modules/screenshot/default.nix b/hosts/pinwheel/modules/screenshot/default.nix index e0f28d1..d31fd2a 100644 --- a/hosts/pinwheel/modules/screenshot/default.nix +++ b/hosts/pinwheel/modules/screenshot/default.nix @@ -19,8 +19,18 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ - "$mod, Print, exec, ${area}" - "$mod CTRL, Print, exec, ${screen}" + { + _args = [ + "SUPER + Print" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${area}")'') + ]; + } + { + _args = [ + "SUPER + CTRL + Print" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${screen}")'') + ]; + } ]; }; }; diff --git a/hosts/pinwheel/modules/sound/default.nix b/hosts/pinwheel/modules/sound/default.nix index f9b56dd..77a355d 100644 --- a/hosts/pinwheel/modules/sound/default.nix +++ b/hosts/pinwheel/modules/sound/default.nix @@ -38,12 +38,19 @@ in MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l) echo $MUTED > /sys/class/leds/platform::micmute/brightness ''; + + mkExec = key: cmd: { + _args = [ + key + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${cmd}")'') + ]; + }; in [ - ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" - ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-" - ", XF86AudioMute, exec, ${toggle-output-mute}" - ", XF86AudioMicMute, exec, ${toggle-input-mute}" + (mkExec "XF86AudioRaiseVolume" "${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+") + (mkExec "XF86AudioLowerVolume" "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-") + (mkExec "XF86AudioMute" "${toggle-output-mute}") + (mkExec "XF86AudioMicMute" "${toggle-input-mute}") ]; }; }; diff --git a/hosts/pinwheel/modules/wezterm/default.nix b/hosts/pinwheel/modules/wezterm/default.nix index d889ba9..8900dea 100644 --- a/hosts/pinwheel/modules/wezterm/default.nix +++ b/hosts/pinwheel/modules/wezterm/default.nix @@ -78,7 +78,12 @@ in wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ - "$mod, RETURN, exec, ${pkgs.wezterm}/bin/wezterm" + { + _args = [ + "SUPER + RETURN" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.wezterm}/bin/wezterm")'') + ]; + } ]; }; };