diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 3e81a55f8..bccd511cb 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1317,6 +1317,23 @@ in A new module is available: 'services.signaturepdf'. ''; } + + { + time = "2023-12-10T08:43:02+00:00"; + condition = config.wayland.windowManager.hyprland.settings ? source; + message = '' + Entries in + + wayland.windowManager.hyprland.settings.source + + are now placed at the start of the configuration file. If you relied + on the previous placement of the 'source' entries, please set + + wayland.windowManager.hyprland.sourceFirst = false + + to keep the previous behaviour. + ''; + } ]; }; } diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 5d3ff438c..3cd3a4b80 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -175,6 +175,12 @@ in { Extra configuration lines to add to `~/.config/hypr/hyprland.conf`. ''; }; + + sourceFirst = lib.mkEnableOption '' + putting source entries at the top of the configuration + '' // { + default = true; + }; }; config = lib.mkIf cfg.enable { @@ -222,9 +228,9 @@ in { inherit indent; }; allFields = filterAttrs (n: v: !(isAttrs v)) attrs; - importantFields = - filterAttrs (n: _: (hasPrefix "$" n) || (hasPrefix "bezier" n)) - allFields; + importantFields = filterAttrs (n: _: + (hasPrefix "$" n) || (hasPrefix "bezier" n) + || (cfg.sourceFirst && (hasPrefix "source" n))) allFields; fields = builtins.removeAttrs allFields (mapAttrsToList (n: _: n) importantFields); in mkFields importantFields diff --git a/tests/modules/services/window-managers/hyprland/simple-config.conf b/tests/modules/services/window-managers/hyprland/simple-config.conf index 7b745e3a1..8d9619014 100644 --- a/tests/modules/services/window-managers/hyprland/simple-config.conf +++ b/tests/modules/services/window-managers/hyprland/simple-config.conf @@ -3,6 +3,7 @@ $mod=SUPER bezier=smoothOut, 0.36, 0, 0.66, -0.56 bezier=smoothIn, 0.25, 1, 0.5, 1 bezier=overshot, 0.4,0.8,0.2,1.2 +source=sourced.conf animations { animation=border, 1, 2, smoothIn animation=fade, 1, 4, smoothOut diff --git a/tests/modules/services/window-managers/hyprland/simple-config.nix b/tests/modules/services/window-managers/hyprland/simple-config.nix index ee8227550..31fe04320 100644 --- a/tests/modules/services/window-managers/hyprland/simple-config.nix +++ b/tests/modules/services/window-managers/hyprland/simple-config.nix @@ -8,6 +8,8 @@ plugins = [ "/path/to/plugin1" (config.lib.test.mkStubPackage { name = "foo"; }) ]; settings = { + source = [ "sourced.conf" ]; + decoration = { shadow_offset = "0 5"; "col.shadow" = "rgba(00000099)";