diff --git a/home-manager/features/hypr/config/hyprland.lua b/home-manager/features/hypr/config/hyprland.lua index 7aaf1ee..b817019 100644 --- a/home-manager/features/hypr/config/hyprland.lua +++ b/home-manager/features/hypr/config/hyprland.lua @@ -84,30 +84,10 @@ hl.device({ sensitivity = -0.200000, }) --- hl.monitor({ --- output = "DP-2", --- mode = "3440x1440@164", --- position = "0x0", --- }) --- hl.monitor({ --- output = "DP-1", --- mode = "2560x1440", --- position = "-1440x-510", --- -- 0 -> normal (no transforms) --- -- 1 -> 90 degrees --- -- 2 -> 180 degrees --- -- 3 -> 270 degrees --- -- 4 -> flipped --- -- 5 -> flipped + 90 degrees --- -- 6 -> flipped + 180 degrees --- -- 7 -> flipped + 270 degrees --- transform = 1, --- }) - -for i = 1, 10 do - hl.workspace_rule({ workspace = i, monitor = "DP-1", default_name = "L" .. tostring(i) }) - hl.workspace_rule({ workspace = i + 10, monitor = "DP-1", default_name = "R" .. tostring(i) }) -end +-- for i = 1, 10 do +-- hl.workspace_rule({ workspace = i, monitor = "DP-1", default_name = "L" .. tostring(i) }) +-- hl.workspace_rule({ workspace = i + 10, monitor = "DP-1", default_name = "R" .. tostring(i) }) +-- end hl.window_rule({ match = "match:class Rofi", stay_focused = true }) -- hl.window_rule({ match = { class = "suppress_event maximize" }, "match:class" = ".*" }) diff --git a/home-manager/features/hypr/hyprland.nix b/home-manager/features/hypr/hyprland.nix index 34f2605..df107df 100644 --- a/home-manager/features/hypr/hyprland.nix +++ b/home-manager/features/hypr/hyprland.nix @@ -18,27 +18,6 @@ recursive = true; }; - "hypr/monitors.lua" = { - text = lib.concatStrings ( - lib.imap0 ( - idx: - { name, value }: - let - offset = idx * 10; - in - lib.concatMapStrings ( - i: - let - ws = offset + i; - in - '' - hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${name}_${toString i}" }) - '' - ) (lib.range 1 10) - ) (lib.attrsToList config.hardware.monitors) - ); - }; - "hypr/config" = { source = ./config; recursive = true; diff --git a/home-manager/options/monitors.nix b/home-manager/options/monitors.nix index 97b9eb6..4de9aca 100644 --- a/home-manager/options/monitors.nix +++ b/home-manager/options/monitors.nix @@ -35,37 +35,66 @@ }; }; - # config = { - # wayland.windowManager.hyprland.settings.monitors = - # let - # transformMap = { - # "none" = { - # normal = 0; - # flipped = 4; - # }; - # "90" = { - # normal = 1; - # flipped = 5; - # }; - # "180" = { - # normal = 2; - # flipped = 6; - # }; - # "270" = { - # normal = 3; - # flipped = 7; - # }; - # }; - # - # monitorTransform = - # m: - # let - # t = transformMap.${m.rotation}; - # in - # if m.flipped then t.flipped else t.normal; - # monitorString = - # name: m: "${name}, ${m.mode}, ${m.position}, 1, transform, ${toString (monitorTransform m)}"; - # in - # lib.mapAttrsToList monitorString config.hardware.monitors; - # }; + config = { + xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable { + text = + let + workspaceSettings = ( + lib.imap0 ( + idx: + { name, value }: + let + offset = idx * 10; + in + lib.concatMapStrings ( + i: + let + ws = offset + i; + in + '' + hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" }) + '' + ) (lib.range 1 10) + ) (lib.attrsToList config.hardware.monitors) + ); + transformMap = { + "none" = { + normal = 0; + flipped = 4; + }; + "90" = { + normal = 1; + flipped = 5; + }; + "180" = { + normal = 2; + flipped = 6; + }; + "270" = { + normal = 3; + flipped = 7; + }; + }; + + monitorTransform = + m: + let + t = transformMap.${m.rotation}; + in + if m.flipped then t.flipped else t.normal; + + monitorString = name: m: '' + hl.monitor({ + output = "${name}", + mode = "${m.mode}", + position = "${m.position}", + transform = ${toString (monitorTransform m)}, + }) + ''; + + monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors; + in + lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings); + }; + }; } diff --git a/system/hosts/vega/drew.nix b/system/hosts/vega/drew.nix index 4f889d3..d19acb3 100644 --- a/system/hosts/vega/drew.nix +++ b/system/hosts/vega/drew.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { imports = map (x: ../../../home-manager + x) [ "/features/chat.nix" @@ -30,7 +30,7 @@ hardware.monitors = { "HDMI-A-1" = { position = "0x0"; - mode = "3440x1440@75.05t s"; + mode = "3440x1440@75.05"; }; };