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?

4 Answers 4

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.

3
  • +1, works flawlessly on wayland.
    – ankostis
    Jun 15, 2019 at 20:51
  • Still relevant. Just fixed my app icon issue on Ubuntu 19.04.
    – Jamie Carl
    Sep 27, 2019 at 1:39
  • Had similar problem on my Kubuntu 20.10, on dolphin, where my custom filetype icon wouldn't refresh. It seems only deleting ~/.cache/icon-cache.kcache and restarting dolphin solved it.
    – geekley
    Oct 17, 2021 at 7:58
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

1
  • ℹ️ For KDE Plasma: rm "${HOME}/.cache/icon-cache.kcache" Mar 2, 2023 at 6:39
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.

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.

7
  • This did not work
    – soapergem
    Jan 24, 2016 at 5: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 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. Jan 24, 2016 at 6:51
  • this answer needs a warning on it.
    – Ace
    Sep 19, 2017 at 5:52
  • @Ace Can you elaborate on the warning? Sep 19, 2017 at 7: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, 2017 at 18:07

You must log in to answer this question.

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