Ubuntu – What’s the absolute path of an icon declared in a .desktop file

xdg

In a .desktop file you can declare an icon, however it's not clear how this translates to an icon on disk:

Icon=eric  

Where on the filesystem can I find this icon?

Related to this question:

Best Answer

It's dependent on the icon theme. If the icon is not given by an absolute path, following rules are used to find the icon:

The lookup is done first in the current theme, and then recursively in each of the current theme's parents, and finally in the default theme called "hicolor" (implementations may add more default themes before "hicolor", but "hicolor" must be last). As soon as there is an icon of any size that matches in a theme, the search is stopped.

[...]

The lookup inside a theme is done in three phases. First all the directories are scanned for an exact match, e.g. one where the allowed size of the icon files match what was looked up. Then all the directories are scanned for any icon that matches the name. If that fails we finally fall back on unthemed icons. If we fail to find any icon at all it is up to the application to pick a good fallback, as the correct choice depends on the context.

See the Icon Theme Specification for details.