30

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
  • 471
  • 1
  • 5
  • 12

4 Answers4

41

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
  • 14,308
  • 4
  • 74
  • 117
Timo Kluck
  • 8,753
  • 1
  • 20
  • 18
10

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
  • 14,308
  • 4
  • 74
  • 117
Brendan Long
  • 411
  • 3
  • 11
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
  • 14,308
  • 4
  • 74
  • 117
L. D. James
  • 24,768
  • 10
  • 68
  • 116
  • This did not work – soapergem Jan 24 '16 at 05:54
  • @SoaperGEM The `unity` the issue with the actual launcher. Running unity at a command prompt will refresh the Ubuntu's Launcher Icons. My answer was directed toward a `Ubuntu Launcher` issue. Since it's not working it's most likely a `gtk` programming issue. You might get better (quicker) answers with the actual gtk programming issue at http://stackoverflow.com. After resolving the actual Icon display of the gtk program that is when you would run the `unity` command to update Ubuntu's Launcher cache. Give me 5 minutes to update my answer. – L. D. James Jan 24 '16 at 06:51
  • this answer needs a warning on it. – Ace Sep 19 '17 at 05:52
  • @Ace Can you elaborate on the warning? – L. D. James Sep 19 '17 at 07:10
  • 3
    @L.D.James , currently running `unity` will force close all running applications and restart unity. I lost data in my browser because of this. – Ace Sep 19 '17 at 18:07
  • @Ace Which version of Ubuntu are you running? My answer was in reference to what was the current version, 16.04 LTS at the time. I use the command often for the purpose of recovering sessions that might be locked by a problematic app. I use it to avoid losing data in my 10's of open windows and applications. I haven't seen any documenting indicating this behavior has changed. If you tell me the version of Ubuntu you are running I'll install that version and test the behavior. If you lost something, I'm sure it's related to something else, not the `unity` command. – L. D. James Sep 19 '17 at 18:52
  • It happens with 16.04 indeed. And I, for one, couldn't even get unity to start, so I had to reboot the whole pc. Of relevance is the fact I'm not an administrator. – mirh Dec 18 '18 at 14:04
1

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 couple seconds.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117