[Hyprland] Adds window rules and introduces per-system config.

This commit is contained in:
2026-06-03 10:32:43 -07:00
parent 59de16ea4c
commit 8276c65d0f
6 changed files with 145 additions and 91 deletions

View File

@@ -84,35 +84,8 @@ hl.device({
sensitivity = -0.200000, sensitivity = -0.200000,
}) })
-- 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" = ".*" })
-- hl.window_rule({ match = { class = "fullscreen 1" }, "match:class" = "^steam_app_d+$" })
-- PATTERN: MERGED with line 208
-- MIGRATION_WARNING: Window rule conflict for 'center on': 'match:class ^steam_app_d+$' (line 199) vs 'match:class Rofi' (line 208)
-- hl.window_rule({ match = { class = "center on" }, match:class = "^steam_app_d+$", match:class = "Rofi" })
-- PATTERN: MERGED with line 202
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:title ^Battle.net$' (line 202)
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:title ^Balatro$' (line 204)
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:class steam_app_1091500' (line 206)
-- hl.window_rule({
-- match = { class = "monitor 1" },
-- match:title = "^World of Warcraft$",
-- match:title = "^Battle.net$",
-- match:title = "^Balatro$",
-- match:class = "steam_app_1091500",
-- })
-- PATTERN: MERGED with line 207
-- MIGRATION_WARNING: Window rule conflict for 'fullscreen on': 'match:title ^World of Warcraft$' (line 201) vs 'match:class steam_app_1091500' (line 207)
-- hl.window_rule({ match = { class = "fullscreen on" }, match:title = "^World of Warcraft$", match:class = "steam_app_1091500" })
-- hl.window_rule({ match = { class = "float on" }, match:title = "^Battle.net$" })
-- hl.window_rule({ match = { class = "tile on" }, match:title = "^Balatro$" })
-- Additional configs -- Additional configs
require("config.autostart") require("config.autostart")
require("config.binds") require("config.binds")
require("config.animation") require("config.animation")
require("config.windows")

View File

@@ -0,0 +1,20 @@
hl.window_rule({
match = {
class = "Rofi",
},
stay_focused = true,
})
-- Set border color to red if window is fullscreen
hl.window_rule({
match = { fullscreen = true },
border_color = "rgb(FF0000) rgb(880808)",
})
-- Suppress maximize events
hl.window_rule({
match = {
class = ".*",
},
suppress_event = "maximize",
})

View File

@@ -47,7 +47,6 @@
]; ];
extraConfig = '' extraConfig = ''
require("monitors")
require("config.hyprland") require("config.hyprland")
''; '';

View File

@@ -35,66 +35,66 @@
}; };
}; };
config = { # config = {
xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable { # xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable {
text = # text =
let # let
workspaceSettings = ( # workspaceSettings = (
lib.imap0 ( # lib.imap0 (
idx: # idx:
{ name, value }: # { name, value }:
let # let
offset = idx * 10; # offset = idx * 10;
in # in
lib.concatMapStrings ( # lib.concatMapStrings (
i: # i:
let # let
ws = offset + i; # ws = offset + i;
in # in
'' # ''
hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" }) # hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" })
'' # ''
) (lib.range 1 10) # ) (lib.range 1 10)
) (lib.attrsToList config.hardware.monitors) # ) (lib.attrsToList config.hardware.monitors)
); # );
transformMap = { # transformMap = {
"none" = { # "none" = {
normal = 0; # normal = 0;
flipped = 4; # flipped = 4;
}; # };
"90" = { # "90" = {
normal = 1; # normal = 1;
flipped = 5; # flipped = 5;
}; # };
"180" = { # "180" = {
normal = 2; # normal = 2;
flipped = 6; # flipped = 6;
}; # };
"270" = { # "270" = {
normal = 3; # normal = 3;
flipped = 7; # flipped = 7;
}; # };
}; # };
#
monitorTransform = # monitorTransform =
m: # m:
let # let
t = transformMap.${m.rotation}; # t = transformMap.${m.rotation};
in # in
if m.flipped then t.flipped else t.normal; # if m.flipped then t.flipped else t.normal;
#
monitorString = name: m: '' # monitorString = name: m: ''
hl.monitor({ # hl.monitor({
output = "${name}", # output = "${name}",
mode = "${m.mode}", # mode = "${m.mode}",
position = "${m.position}", # position = "${m.position}",
transform = ${toString (monitorTransform m)}, # transform = ${toString (monitorTransform m)},
}) # })
''; # '';
#
monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors; # monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors;
in # in
lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings); # lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings);
}; # };
}; # };
} }

View File

@@ -56,6 +56,16 @@
"secondary-statusbar" "secondary-statusbar"
]; ];
xdg.configFile = {
"hypr/altair.lua" = {
source = ./hyprland.lua;
};
};
wayland.windowManager.hyprland.extraConfig = ''
require("altair")
'';
# TODO: Still merging these into the LUA config # TODO: Still merging these into the LUA config
# wayland.windowManager.hyprland.settings = { # wayland.windowManager.hyprland.settings = {
# exec_once = [ # exec_once = [

View File

@@ -0,0 +1,52 @@
-- These configs are specifically for Altair
-----------------------------------------------------------
for i = 1, 10 do
hl.workspace_rule({ workspace = i, monitor = "DP-1", default_name = tostring(i) })
hl.workspace_rule({ workspace = i + 10, monitor = "DP-2", default_name = tostring(i) })
end
hl.monitor({
output = "DP-1",
mode = "2560x1440",
position = "-1440x-510",
transform = 1,
})
hl.monitor({
output = "DP-2",
mode = "3440x1440@164",
position = "0x0",
transform = 0,
})
hl.window_rule({
match = {
class = "^steam_app_\\d+$",
},
fullscreen = true,
monitor = "DP-2",
center = true,
})
-- hl.window_rule({ match = { class = "suppress_event maximize" }, "match:class" = ".*" })
-- hl.window_rule({ match = { class = "fullscreen 1" }, "match:class" = "^steam_app_d+$" })
-- PATTERN: MERGED with line 208
-- MIGRATION_WARNING: Window rule conflict for 'center on': 'match:class ^steam_app_d+$' (line 199) vs 'match:class Rofi' (line 208)
-- hl.window_rule({ match = { class = "center on" }, match:class = "^steam_app_d+$", match:class = "Rofi" })
-- PATTERN: MERGED with line 202
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:title ^Battle.net$' (line 202)
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:title ^Balatro$' (line 204)
-- MIGRATION_WARNING: Window rule conflict for 'monitor 1': 'match:title ^World of Warcraft$' (line 200) vs 'match:class steam_app_1091500' (line 206)
-- hl.window_rule({
-- match = { class = "monitor 1" },
-- match:title = "^World of Warcraft$",
-- match:title = "^Battle.net$",
-- match:title = "^Balatro$",
-- match:class = "steam_app_1091500",
-- })
-- PATTERN: MERGED with line 207
-- MIGRATION_WARNING: Window rule conflict for 'fullscreen on': 'match:title ^World of Warcraft$' (line 201) vs 'match:class steam_app_1091500' (line 207)
-- hl.window_rule({ match = { class = "fullscreen on" }, match:title = "^World of Warcraft$", match:class = "steam_app_1091500" })
-- hl.window_rule({ match = { class = "float on" }, match:title = "^Battle.net$" })
-- hl.window_rule({ match = { class = "tile on" }, match:title = "^Balatro$" })