1

There is an blog article on ubuntu developer blog. http://developer.ubuntu.com/2012/02/how-to-prepare-a-compiled-application-for-ubuntu-software-center/

I followed all steps exactly. But the application seems to have no icon when I search it in the dash. The dash displays only blank white icon.

I am using Ubuntu 12.04

dobey
  • 40,982
vrcmr
  • 6,307

2 Answers2

3

The Icon field in the .desktop file, and the file name of the icon file itself, must match. As per the Icon Naming Specification, the name should be the same as the application's executable program. It should also be installed in the appropriate sizes, in the appropriate hicolor icon theme directory, as per the Icon Theme Specification.

It seems there is a typo in the page you link to, which says to name the icon as desktop.png instead of dungeon.png, and it also only talks about installing the single icon, and in the wrong place. This should be considered a bug in the site itself.

If the icons are in the correct place, and still not showing up, it is likely you need to update the icon cache for theme. You can run sudo gtk-update-icon-cache -f /usr/share/icons/hicolor to update the system hicolor theme directory cache, for example.

dobey
  • 40,982
  • Even if I type the icon name correctly it doesn't appear in the dash or launcher. Very sad. I can use xdg-icon-resource after installing the package but this is a hack. – vrcmr Apr 02 '13 at 20:29
  • 1
    Where did you put the icon on the filesystem? – dobey Apr 02 '13 at 21:26
  • this is my install

    thegame_01/* opt/thegame hicolor/scalable/apps/thegame.svg usr/share/icons/hicolor/scalable/apps/thegame.svg hicolor/64x64/apps/thegame.png usr/share/icons/hicolor/64x64/apps/thegame.png hicolor/48x48/apps/thegame.png usr/share/icons/hicolor/48x48/apps/thegame.png hicolor/32x32/apps/thegame.png usr/share/icons/hicolor/32x32/apps/thegame.png thegame.desktop usr/share/applications

    – vrcmr Apr 03 '13 at 11:27
2

To properly install an icon for an application use xdg-icon-resource. The image files must be one of the types: PNG, XPM, or SVG, and the extension must be ".png", ".xpm", or ".svg" (lower case). If a corresponding .icon file exists in the same location as icon-file it will be installed as well.

For .svg files

xdg-icon-resource install --novendor </location/of/your/icon.svg> <icon_name>.

For .png and .xpm files

xdg-desktop-icon install --size <16, 22, 32, 48, 64, 128, or 256> </location/of/your/icon.png> <a_name_you_want>.

The default icon size launchers and menus use is 48.

Other sources of info: http://portland.freedesktop.org/xdg-utils-1.0beta1/xdg-icon-resource.html http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

  • 1
    How do you make xdg-icon-resource put files in a hierarchy that you're about to package, rather than on the host filesystem? – Jack O'Connor Jan 22 '16 at 19:07
  • I'm afraid xdg-icon-resource does not support SVG: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/790449 – Emmanuel Touzery Jul 19 '16 at 05:44
  • @JackO'Connor: the same way you put binaries and man pages: use dpkg-buildpackage or similar packaging script along with the appropriate dh_* helpers in your rules file, and it will invoke xdg-icon-resource for you in a chroot when creating the binary package. – MestreLion Aug 20 '20 at 17:08
  • -1: xdg-desktop-icon is not for installing icon images in the system, but to install a .desktop launcher in the user's Desktop. The -icon in name is misleading. Also, the suggested xdg-icon-resource command simply does not work: --size is required, and it does not support SVG files at all. – MestreLion Aug 20 '20 at 17:14