fix(hyprland): remove enable override, use workspace_rule and table-based window_rule syntax

- Remove redundant `enable = true` from host hyprland blocks to avoid
  circular module reference (Hyprland is already enabled via m3ta-home
  profile flags; these files only add host-specific settings)
- Replace legacy string-format `workspace = ["1, monitor:..."]` entries
  with proper `workspace_rule` attrsets (e.g. `{ workspace = "1";
  monitor = "DP-1"; default = true; }`) per current Hyprland Lua docs
- Replace `_args + mkLuaInline hl.dsp.window.match(...)` window_rule
  pattern with clean single-table `{ match.class = "..."; effect; }`
  attrsets per Home Manager module examples
- Keep `configType = "lua"` and monitor table syntax unchanged
This commit is contained in:
m3tm3re
2026-05-18 19:07:42 +02:00
parent 9bd6d38a95
commit 6c26ade621
2 changed files with 92 additions and 114 deletions
+35 -58
View File
@@ -39,11 +39,10 @@ with lib; {
# ── Hyprland monitor layout ──
(mkIf config.wayland.windowManager.hyprland.enable {
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
settings = {
# Startup commands (using on hook for Lua config)
# Startup commands — hl.on() for Lua config
on = {
_args = [
"hyprland.start"
@@ -55,8 +54,7 @@ with lib; {
];
};
# Monitor configuration — use Lua table syntax hl.monitor({...})
# Each list entry generates one hl.monitor(...) call.
# Monitor configuration: each list entry → hl.monitor({...})
monitor = [
{
_args = [
@@ -80,87 +78,66 @@ with lib; {
}
];
# Simple workspace→monitor bindings (legacy string format OK for hl.workspace)
workspace = [
"1, monitor:eDP-1, default:true"
"2, monitor:eDP-1"
"3, monitor:eDP-1"
"4, monitor:HDMI-A-1"
"6, monitor:HDMI-A-1"
];
# Workspace rules with special properties → use workspace_rule + Lua table
# Workspace rules → hl.workspace_rule({ workspace, monitor, default, ... })
workspace_rule = [
{
_args = [
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";
}
];
# Window rules — match + effect fields as Lua table
# Per Hyprland Lua docs: match fields (class, title, etc.) and
# effect fields (workspace, fullscreen, opacity, etc.) together
# in one table passed to hl.window_rule({...}).
# Window rules → hl.window_rule({ match = { class = "..." }, effect, ... })
window_rule = [
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "dev.zed.Zed" })'')
{workspace = "1";}
];
match.class = "dev.zed.Zed";
workspace = "1";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "Msty" })'')
{workspace = "1";}
];
match.class = "Msty";
workspace = "1";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "com\\.obsproject\\.Studio" })'')
{workspace = "2";}
];
match.class = "com\\.obsproject\\.Studio";
workspace = "2";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "brave-browser" })'')
{
match.class = "brave-browser";
workspace = "4";
opacity = "1.0";
}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "vivaldi-stable" })'')
{
match.class = "vivaldi-stable";
workspace = "4";
opacity = "1.0";
}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "steam_app_\\d+" })'')
{fullscreen = true;}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "steam_app_\\d+" })'')
{workspace = "5";}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "steam_app_\\d+" })'')
{idle_inhibit = "focus";}
];
match.class = "steam_app_\\d+";
fullscreen = true;
workspace = "5";
idle_inhibit = "focus";
}
];
};
+43 -42
View File
@@ -39,12 +39,10 @@ with lib; {
# ── Hyprland monitor layout ──
(mkIf config.wayland.windowManager.hyprland.enable {
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
settings = {
# Monitor configuration — use Lua table syntax hl.monitor({...})
# Each list entry generates one hl.monitor(...) call.
# Monitor configuration: each list entry → hl.monitor({...})
monitor = [
{
_args = [
@@ -68,63 +66,66 @@ with lib; {
}
];
# Simple workspace→monitor bindings (legacy string format OK for hl.workspace)
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 rules → hl.workspace_rule({ workspace, monitor, default, ... })
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";
}
];
# Window rules — match + effect fields as Lua table
# Per Hyprland Lua docs: match fields (class, title, etc.) and
# effect fields (workspace, fullscreen, opacity, etc.) together
# in one table passed to hl.window_rule({...}).
# Window rules → hl.window_rule({ match = { class = "..." }, effect, ... })
window_rule = [
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "dev.zed.Zed" })'')
{workspace = "1";}
];
match.class = "dev.zed.Zed";
workspace = "1";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "Msty" })'')
{workspace = "1";}
];
match.class = "Msty";
workspace = "1";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "com\\.obsproject\\.Studio" })'')
{workspace = "2";}
];
match.class = "com\\.obsproject\\.Studio";
workspace = "2";
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "brave-browser" })'')
{
match.class = "brave-browser";
workspace = "4";
opacity = "1.0";
}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "vivaldi-stable" })'')
{
match.class = "vivaldi-stable";
workspace = "4";
opacity = "1.0";
}
];
}
{
_args = [
(lib.generators.mkLuaInline ''hl.dsp.window.match({ class = "steam_app_\\d+" })'')
{idle_inhibit = "focus";}
];
match.class = "steam_app_\\d+";
idle_inhibit = "focus";
}
];
};