From a0ad98174c7a1f9747a76025a83b50e37181bbde Mon Sep 17 00:00:00 2001 From: polykernel <81340136+polykernel@users.noreply.github.com> Date: Mon, 21 Aug 2023 19:13:17 -0400 Subject: [PATCH] home-cursor: remove IFD when linking icon directories An IFD was introduced in bdb5bcad01ff7332fdcf4b128211e81905113f84 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. --- modules/config/home-cursor.nix | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/config/home-cursor.nix b/modules/config/home-cursor.nix index c0268db6e..2a95e1045 100644 --- a/modules/config/home-cursor.nix +++ b/modules/config/home-cursor.nix @@ -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 = - "${defaultIndexThemePackage}/share/icons/default/index.theme"; - }; + 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 = - "${defaultIndexThemePackage}/share/icons/default/index.theme"; - }; + # 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 {