I'm creating a .deb package for an application (not for public distribution) and want to have an icon for the application for the taskbar, menu, dock, etc. My application's .desktop
file has a line to specify icons, like:
Icon=preferences-desktop-keyboard
But how and where do you actually create a new icon?
Let's say I wanted to take an existing icon like the ImageMagick icon shown in /usr/share/applications/ImageMagick
. The display.im6.desktop
file (which is what actually opens when you try to edit /usr/share/applications/ImageMagick
) has the line Icon=display.im6
.
Ok, great. Since there's no full path, how do I find the graphics file for display.im6
? What format is it in? Or are these dynamic files where there's a set of them for different sizes?
Then, I assume I can edit it/them in either GIMP or Inkscape?
Now, what format do I export it as, and to where? And do I need to create some type of meta file so that I can add a line to my application's launcher that reads Icon=myicon
and the system will know where to get the icon from?
Update
locate display.im6
shows about 15 entries. There seems to be two themes, and a bunch of different sizes including one called scalable. I can't create an icon for each theme the user might have, so I guess I need to create a default icon somewhere? Or do I need a set of them in all the sizes? Or can I just create a scalable file and it will figure it out?
Update 2
I used locate
to find an existing icon in .svg format and edited in inkscape. I tried adding it to the .desktop
file with the full path:
Icon=/opt/myapp/lib/myapp-51.0.2/icons/myapp.svg
And the .desktop
file has this icon now, but when you install the .desktop
launcher into /usr/share/applications/
the luancher on the main menu has a red "missing icon" icon.
so I'm still not sure how you create a specify an icon stack with the different file formats and sizes and where those files get placed, and how you attach the set to the .desktop
file.
It is recommended to install the icon into:
/usr/share/pixmaps/
or:
$XDG_DATA_DIRS/icons
Then declare it in the
.desktop
file as (without extension):Only if you have a flat package that installed to
/opt
folder, then you have to use the absolute path:BTW, If it didn't work, possibly you have a permission issue. Icons should be readable by all.
Reference: freedesktop.org - Icon Theme Specification
The simplest way is to manually specify the image file: