4

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.

1
  • Run sudo updatedb, then run locate display.im6. It'll probably be somewhere in /usr/share/icons. As far as creating your own, I don't know the specifics, but it looks like at the very least both SVG and PNG files are used. Feb 16, 2017 at 18:21

2 Answers 2

2
  • 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):

    Icon=filename
    
  • Only if you have a flat package that installed to /opt folder, then you have to use the absolute path:

    Icon=/opt/fullpath/filename.ext
    

BTW, If it didn't work, possibly you have a permission issue. Icons should be readable by all.

Reference: freedesktop.org - Icon Theme Specification

0

The simplest way is to manually specify the image file:

Icon=/usr/share/icons/MYPROGRAM/MYICON.png
1
  • This doesn't account for the various sizes though, and specifying an svg file in the Icon property results in a missing icon on the applications menu.
    – Nick
    Feb 17, 2017 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .