Where to put application icons on Linux
When you write a GUI application and want to install it properly on a Linux system you will ask yourself where to store the application’s icon so that it is shown in the application menu of the desktop environment. To my surprise, I found this a bit confusing. In particular, I was interested in Debian and the Gnome 3 desktop because this is what I happen to use myself. Here are what seemed to be the most relevant sources to me.
The guide on the Debian Menu System has this to say:
- Icon files should go to
- They should be in XPM format.
- They should not be larger than 32x32 px, smaller sizes are okay.
- They should have a transparent background.
The freedesktop.org Icon Theme Specification (version 0.11) gives us the following advice:
- An icon file sized 48x48 px (probably PNG?) should go to
- Aditionally, bigger or smaller icons may be provided in other
/usr/share/icons/hicolor/*/apps/directories, in particular an SVG file in
This sounds somewhat contradictory but on a current Debian Jessie, you will in fact find icon files in all of the mentioned directories. So if you like to be pragmatic you should probably install an icon file in at least three places to ensure optimal performance:
- A 32x32 px XPM file in
- A 48x48 px PNG file in
- Optionally, an SVG file in
Of course you also need a
desktop file in
/usr/share/applications/ for your program.
And just in case, you can easily create XPM and PNG files from a source SVG file:
$ inkscape -e icon.png -C -w 48 -h 48 icon.svg $ inkscape -e tmp.png -C -w 32 -h 32 icon.svg $ convert tmp.png icon.xpm $ rm tmp.png