[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,
})
-- 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
require("config.autostart")
require("config.binds")
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 = ''
require("monitors")
require("config.hyprland")
'';

View File

@@ -35,66 +35,66 @@
};
};
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);
};
};
# 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);
# };
# };
}

View File

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