From 58fecf72df952a082795cf8a89c3463bd5b3ffbc Mon Sep 17 00:00:00 2001 From: m3ta-chiron Date: Sat, 1 Aug 2026 10:53:09 +0200 Subject: [PATCH] feat: migrate host Hyprland overrides to Lua --- hosts/m3-ares/home.nix | 112 ++++++++++++++++++++++++++++++------- hosts/m3-kratos/home.nix | 116 +++++++++++++++++++++++++++++---------- 2 files changed, 178 insertions(+), 50 deletions(-) diff --git a/hosts/m3-ares/home.nix b/hosts/m3-ares/home.nix index 9bac583..483cca7 100644 --- a/hosts/m3-ares/home.nix +++ b/hosts/m3-ares/home.nix @@ -7,7 +7,20 @@ lib, ... }: -with lib; { +with lib; let + lua = lib.generators.mkLuaInline; + + startupCommand = command: { + _args = [ + "hyprland.start" + (lua '' + function() + hl.exec_cmd(${builtins.toJSON command}) + end + '') + ]; + }; +in { config = mkMerge [ # ── XDG / MIME defaults ── { @@ -41,28 +54,87 @@ with lib; { wayland.windowManager.hyprland = { enable = true; settings = { - exec-once = ["tuxedo-backlight"]; + on = [ + (startupCommand "tuxedo-backlight") + ]; monitor = [ - "eDP-1,preferred,0x0,1.25" - "HDMI-A-1,1920x1080@120,2560x0,1" + { + output = "eDP-1"; + mode = "preferred"; + position = "0x0"; + scale = 1.25; + } + { + output = "HDMI-A-1"; + mode = "1920x1080@120"; + position = "2560x0"; + scale = 1; + } ]; - workspace = [ - "1, monitor:eDP-1, default:true" - "2, monitor:eDP-1" - "3, monitor:eDP-1" - "4, monitor:HDMI-A-1" - "5, monitor:HDMI-A-1,border:false,rounding:false" - "6, monitor:HDMI-A-1" + workspace_rule = [ + { + workspace = "1"; + monitor = "eDP-1"; + default = true; + } + { + workspace = "2"; + monitor = "eDP-1"; + } + { + workspace = "3"; + monitor = "eDP-1"; + } + { + workspace = "4"; + monitor = "HDMI-A-1"; + } + { + workspace = "5"; + monitor = "HDMI-A-1"; + no_border = true; + no_rounding = true; + } + { + workspace = "6"; + monitor = "HDMI-A-1"; + } ]; - windowrule = [ - "match:class dev.zed.Zed, workspace 1" - "match:class Msty, workspace 1" - "match:class ^(com.obsproject.Studio)$, workspace 2" - "match:class ^(brave-browser)$, workspace 4, opacity 1.0" - "match:class ^(vivaldi-stable)$, workspace 4, opacity 1.0" - "match:class ^steam_app_\\d+$, fullscreen on" - "match:class ^steam_app_\\d+$, workspace 5" - "match:class ^steam_app_\\d+$, idle_inhibit focus" + window_rule = [ + { + match.class = "dev.zed.Zed"; + workspace = "1"; + } + { + match.class = "Msty"; + workspace = "1"; + } + { + match.class = "^(com.obsproject.Studio)$"; + workspace = "2"; + } + { + match.class = "^(brave-browser)$"; + workspace = "4"; + opacity = "1.0"; + } + { + match.class = "^(vivaldi-stable)$"; + workspace = "4"; + opacity = "1.0"; + } + { + match.class = "^steam_app_\\d+$"; + fullscreen = true; + } + { + match.class = "^steam_app_\\d+$"; + workspace = "5"; + } + { + match.class = "^steam_app_\\d+$"; + idle_inhibit = "focus"; + } ]; }; }; diff --git a/hosts/m3-kratos/home.nix b/hosts/m3-kratos/home.nix index 4822a72..cdeb08c 100644 --- a/hosts/m3-kratos/home.nix +++ b/hosts/m3-kratos/home.nix @@ -7,7 +7,14 @@ lib, ... }: -with lib; { +with lib; let + mkEnvVar = name: value: { + _args = [ + name + value + ]; + }; +in { imports = [ ]; @@ -47,40 +54,89 @@ with lib; { enable = true; settings = { monitor = [ - "DP-1,2560x1440@144,0x0,1" - "DP-2,2560x1440@144,2560x0,1" + { + output = "DP-1"; + mode = "2560x1440@144"; + position = "0x0"; + scale = 1; + } + { + output = "DP-2"; + mode = "2560x1440@144"; + position = "2560x0"; + scale = 1; + } ]; - workspace = [ - "1, monitor:DP-1, default:true" - "2, monitor:DP-1" - "3, monitor:DP-1" - "4, monitor:DP-2" - "5, monitor:DP-2" - "6, monitor:DP-2" - "7, monitor:DP-2" + workspace_rule = [ + { + workspace = "1"; + monitor = "DP-1"; + default = true; + } + { + workspace = "2"; + monitor = "DP-1"; + } + { + workspace = "3"; + monitor = "DP-1"; + } + { + workspace = "4"; + monitor = "DP-2"; + } + { + workspace = "5"; + monitor = "DP-2"; + } + { + workspace = "6"; + monitor = "DP-2"; + } + { + workspace = "7"; + monitor = "DP-2"; + } ]; - # m3ta-home sets QT_QPA_PLATFORMTHEME=gtk3 globally for Hyprland. + # m3ta-home sets QT_QPA_PLATFORMTHEME to gtk3 globally for Hyprland. # ksnip crashes with duplicate GDK type registration under that Qt GTK # platform theme, so use qtct for Qt apps on this host instead. - env = mkForce [ - "XCURSOR_SIZE,32" - "HYPRCURSOR_THEME,Bibata-Modern-Ice" - "WLR_NO_HARDWARE_CURSORS,1" - "XDG_CURRENT_DESKTOP,Hyprland" - "XDG_SESSION_TYPE,wayland" - "XDG_SESSION_DESKTOP,Hyprland" - "XKB_DEFAULT_LAYOUT,de" - "NIXOS_OZONE_WL,1" - "QT_QPA_PLATFORM,wayland;xcb" - "QT_QPA_PLATFORMTHEME,qt5ct" - "QT_QPA_PLATFORMTHEME_QT6,qt6ct" + "env" = mkForce [ + (mkEnvVar "XCURSOR_SIZE" "32") + (mkEnvVar "HYPRCURSOR_THEME" "Bibata-Modern-Ice") + (mkEnvVar "WLR_NO_HARDWARE_CURSORS" "1") + (mkEnvVar "XDG_CURRENT_DESKTOP" "Hyprland") + (mkEnvVar "XDG_SESSION_TYPE" "wayland") + (mkEnvVar "XDG_SESSION_DESKTOP" "Hyprland") + (mkEnvVar "XKB_DEFAULT_LAYOUT" "de") + (mkEnvVar "NIXOS_OZONE_WL" "1") + (mkEnvVar "QT_QPA_PLATFORM" "wayland;xcb") + (mkEnvVar "QT_QPA_PLATFORMTHEME" "qt5ct") + (mkEnvVar "QT_QPA_PLATFORMTHEME_QT6" "qt6ct") ]; - windowrule = [ - "match:class dev.zed.Zed, workspace 1" - "match:class ^(com.obsproject.Studio)$, workspace 2" - "match:class ^(brave-browser)$, workspace 4, opacity 1.0" - "match:class ^(vivaldi-stable)$, workspace 4, opacity 1.0" - "match:class ^steam_app_\\d+$, idle_inhibit focus" + window_rule = [ + { + match.class = "dev.zed.Zed"; + workspace = "1"; + } + { + match.class = "^(com.obsproject.Studio)$"; + workspace = "2"; + } + { + match.class = "^(brave-browser)$"; + workspace = "4"; + opacity = "1.0"; + } + { + match.class = "^(vivaldi-stable)$"; + workspace = "4"; + opacity = "1.0"; + } + { + match.class = "^steam_app_\\d+$"; + idle_inhibit = "focus"; + } ]; }; };