5

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:

Jorge Castro
  • 71,754

2 Answers2

4

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.

htorque
  • 64,798
  • Sounds like an "effective icon path" shell script would be useful. ("ubuntu-which-icon eric" would return /path/to/eric.xpm as used by ubuntu unity desktop) – Warren P Oct 16 '11 at 14:05
  • You can do that like described here: http://stackoverflow.com/questions/6090241/how-can-i-get-the-full-file-path-of-an-icon-name Not sure there is a simpler way to do it (like an already existing command). – htorque Oct 16 '11 at 14:10
0

You can either specify the full path of your png/xpm file or you can install your icon first using xdg.

Example:

xdg-icon-resource install /path/to/your/icon.xpm --size 64

Then you will find it in the below path:

/usr/share/icons/hicolor/64x64/apps#

With this, you will be able to specify the icon name on your .desktop file instead of the full path.