34

First of all, I'm not 100% positive that the main question I've written here is actually the problem, but I have a hunch that it is. I've wrote a simple Gtk# application in Mono awhile ago, and gave it a custom ICO as its icon file. Worked great.

Recently I went to change out this icon to a different one, but when I build and run the program it still shows the icon. I've made sure that I've updated every reference to the icon file to the new one, and have completely deleted the old icon off the hard drive altogether. But it still shows up in the Launcher when I run the program.

I am assuming this means that Gtk caches the icons somewhere in Ubuntu and I probably need to force that to refresh. Any advice?

soapergem
  • 521

4 Answers4

47

Run the following in a terminal:

sudo update-icon-caches /usr/share/icons/*

From man page:

update-icon-caches is a wrapper script for updating the icon caches in a list of directories.

In each of the directories passed as arguments, the icon cache is updated if it is already present. It is not created if it does not already exist.

If the theme index file is not present, the icon cache is removed.

Pablo Bianchi
  • 17,371
Timo Kluck
  • 9,173
12

You need to:

Note: hicolor is the default theme which app developers should use. If you're making an icon theme, refresh your icon theme's folder instead.

sudo touch /usr/share/icons/hicolor ~/.local/share/icons/hicolor
sudo gtk-update-icon-cache

See (the only documentation I can find for this): https://fedoraproject.org/wiki/Packaging:Scriptlets#Icon_Cache

Pablo Bianchi
  • 17,371
3

From Unix SE: Please refer to the XDG Desktop Menu Specification. To update the list of available desktop launchers in the Applications menu please run:

xdg-desktop-menu forceupdate

The update will be reflected in a couple seconds.

Pablo Bianchi
  • 17,371
2

If using Unity (until Ubuntu 17.04): At the terminal command prompt type:

$ unity

This will update your *.desktop icons in the Launcher.

If the problem is not the Ubuntu Launcher but the application itself, take a look stackoverflow.com for programming resolutions.

A similar issue to this is answered at here. Also look here.

Pablo Bianchi
  • 17,371
L. D. James
  • 25,444