home-cursor: remove IFD when linking icon directories

An IFD was introduced in bdb5bcad01 from
reading the top-level directories of the `home.pointerCursor.package`
at instantiation time.

This commit removes the IFD introduced when linking icon directories
by linking only the icon directory matching `home.pointerCursor.name`
in `home.pointerCursor.package`. This should be functionally
equivalent to linking all top-level directories of the supplied icon
package as the module only generates cursor configurations pertaining
to the cursor identified by `home.pointerCursor.name`. Deviations in
behavior caused by additional files linked in $HOME/.icons as of the
status quo should be treated as impurities.
This commit is contained in:
polykernel 2023-08-21 19:13:17 -04:00 committed by Robert Helgesson
parent 958c06303f
commit a0ad98174c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -66,13 +66,6 @@ let
'';
};
iconMappings = let
knownFiles = filterAttrs (_: type: type != "unknown")
(builtins.readDir "${cfg.package}/share/icons");
in mapAttrs'
(n: _: nameValuePair ".icons/${n}" "${cfg.package}/share/icons/${n}")
knownFiles;
in {
meta.maintainers = [ maintainers.polykernel maintainers.league ];
@ -154,20 +147,19 @@ in {
XCURSOR_THEME = mkDefault cfg.name;
};
# Add symlinks of cursor icons to subdirectories in $HOME/.icons, needed for
# Add symlink of cursor icon directory to $HOME/.icons, needed for
# backwards compatibility with some applications. See:
# https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html
home.file = (mapAttrs (_: source: { inherit source; }) iconMappings) // {
".icons/default/index.theme".source =
home.file.".icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
};
home.file.".icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
# Add cursor icon links to $XDG_DATA_HOME as well for redundancy.
xdg.dataFile = (mapAttrs (_: source: { inherit source; }) iconMappings)
// {
".icons/default/index.theme".source =
# Add cursor icon link to $XDG_DATA_HOME as well for redundancy.
xdg.dataFile.".icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
};
xdg.dataFile.".icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
}
(mkIf cfg.x11.enable {