From 2e75be49f49e93201876e9688d64abe4c79514e4 Mon Sep 17 00:00:00 2001 From: m3ta-chiron Date: Mon, 28 Sep 2026 18:13:14 +0200 Subject: [PATCH] fix(hyprland): make dms module requires detectable by DMS DMS detects config inclusion via a static text scan (dms config resolve-include, regex matches literal require("name") calls only). The require_if_present wrapper hid every dms.* module from that scan, so DMS reported included:false for all files even though Hyprland loaded them fine (colors/binds-user/outputs were verifiably active). Replace the wrapper with guarded single-line literal requires and add dms.windowrules (user-managed DMS window rules, e.g. vibe-typer size and com.danklinux.dms float) to the load list. --- profiles/contexts/desktop/wm/hyprland.nix | 36 +++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/profiles/contexts/desktop/wm/hyprland.nix b/profiles/contexts/desktop/wm/hyprland.nix index 3941521..e3f40c2 100644 --- a/profiles/contexts/desktop/wm/hyprland.nix +++ b/profiles/contexts/desktop/wm/hyprland.nix @@ -57,23 +57,29 @@ in { extraLuaFiles."00-dms" = { autoLoad = true; content = '' - -- DMS setup/runtime owns these modules. Load only the Lua equivalents - -- of the pre-migration active sources, before local Home Manager - -- settings, preserving the old source-first order without enabling new - -- DMS default binds or rules. + -- DMS setup/runtime owns these modules. Load the Lua equivalents of + -- the pre-migration active sources (colors, layout, outputs) plus the + -- user-managed binds-user and windowrules, before local Home Manager + -- settings, preserving the old source-first order without enabling + -- DMS default binds (dms.binds stays unloaded). -- -- Keep fresh Home Manager generations usable before DMS has written - -- ~/.config/hypr/dms/*.lua. - local function require_if_present(module) - if package.searchpath(module, package.path) ~= nil then - require(module) - end - end - - require_if_present("dms.colors") - require_if_present("dms.layout") - require_if_present("dms.outputs") - require_if_present("dms.binds-user") + -- ~/.config/hypr/dms/*.lua: each require is guarded by + -- package.searchpath. Hyprland's safeLuaRequire would swallow a + -- missing module silently, but the guards keep `hyprctl + -- configerrors` clean. + -- + -- IMPORTANT: keep every require call as a literal single-line + -- statement. DMS detects inclusion via a static text scan + -- (dms config resolve-include, regex: word-boundary require + -- followed by a quoted module name) and does NOT follow wrapper + -- functions like require_if_present — hiding the calls behind a + -- helper made DMS report all dms modules as not included. + if package.searchpath("dms.colors", package.path) then require("dms.colors") end + if package.searchpath("dms.layout", package.path) then require("dms.layout") end + if package.searchpath("dms.outputs", package.path) then require("dms.outputs") end + if package.searchpath("dms.binds-user", package.path) then require("dms.binds-user") end + if package.searchpath("dms.windowrules", package.path) then require("dms.windowrules") end ''; }; settings = {