findClosestIcon - multiple declarations

Function findClosestIcon

Find icon of the closest size. It uses icon theme cache wherever possible. The first perfect match is used. This is similar to findClosestThemedIcon, but returns file path only and allows to search for non-themed icons.

string findClosestIcon(alias subdirFilter, IconThemes, BaseDirs, Exts) (
  string iconName,
  uint desiredSize,
  IconThemes iconThemes,
  BaseDirs searchIconDirs,
  Exts extensions,
  Flag!"allowNonThemed" allowNonThemed = Yes.allowNonThemed
);

Parameters

NameDescription
iconName Name of icon to search as defined by Icon Theme Specification (i.e. without path and extension parts).
desiredSize Preferred icon size to get.
iconThemes Range of IconThemeFile objects.
searchIconDirs Base icon directories.
extensions Allowed file extensions.
allowNonThemed Allow searching for non-themed icon if could not find icon in themes (non-themed icon can be any size).

Returns

Icon file path or empty string if not found.

Note

If icon of some size was found in the icon theme, this algorithm does not check following themes, even if they contain icons with closer size. Therefore the icon found in the more preferred theme always has presedence over icons from other themes.

See Also

findClosestThemedIcon, baseIconDirs, lookupIcon, findNonThemedIcon, iconSizeDistance

Function findClosestIcon

ditto, but with predefined extensions and non-themed icons allowed.

string findClosestIcon(alias subdirFilter, IconThemes, BaseDirs) (
  string iconName,
  uint size,
  IconThemes iconThemes,
  BaseDirs searchIconDirs
);

See Also

defaultIconExtensions