1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-25 19:29:47 +01:00

hyprland: add option sourceFirst

Add the option sourceFirst to the hyprland module. When this option is
enabled source entries will be put near the top of the file, so that
the variables declared in other files can be used by the other
configuration entries.

Add "source" to the list of important prefixes when the former option
is enabled.

Resolves #4729
This commit is contained in:
Nara Díaz Viñolas 2023-12-09 13:26:07 +01:00 committed by Mikilio
parent a4612b881b
commit 7edbaf84cd
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F
4 changed files with 29 additions and 3 deletions

View file

@ -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.
'';
}
];
};
}

View file

@ -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

View file

@ -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

View file

@ -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)";