101

I just added and modified a .desktop file in my /home/user/.local/share/applications folder.

Is there any way to refresh the icon and caption in the list of applications without logging out?

6 Answers 6

98

You can restart the gnome-shell by pressing Alt+F2 and then typing in either "restart" or just "r" and pressing Enter.

Otherwise I've noticed that it automatically refreshes .desktop files after waiting a little while.

4
  • Well, that alt-f2 really made is so I didn't even need to do it. and I did notice that it was refreshing my applications. Now all my applications are gone. I must have messed something up! But there must be cron job to do it then eh? I'll check there. Apr 27, 2011 at 13:41
  • 2
    Worked perfectly for me
    – garryp
    Mar 10, 2016 at 18:44
  • 28
    This will show "Restart is not available on Wayland" as of gnome-shell-3.20
    – lkraav
    Jun 27, 2016 at 22:40
  • 1
    -1, this doesn't work on Wayland, which is very common nowadays and cannot be ignored in the answer. The message is "Restart is not available on Wayland" , as Ikraav already reported.
    – ocroquette
    Dec 17, 2022 at 6:50
55

From Desktop entries in Arch linux wiki, this works on later versions of Gnome:

update-desktop-database ~/.local/share/applications
4
  • it's works on wayland GNOME
    – mmv-ru
    Jun 12, 2022 at 13:55
  • This is the correct way of doing it. Dec 25, 2022 at 18:13
  • sometimes sudo is also needed
    – Eyad Ahmed
    Sep 3, 2023 at 4:01
  • This also works for KDE
    – Raven
    Dec 20, 2023 at 8:54
12

Cross-posting this from the Ubuntu question site.

You need to:

  • Update the timestamp on the top-level icon directory
  • Run gtk-update-icon-cache

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

2
  • when running wayland, doing alt+f2, and then run "r" wont work. This saved me a lot of time. (otherwise have to logout and login again)
    – Daverix
    Nov 28, 2017 at 11:50
  • the "touch" trick saves my day!
    – tai271828
    Jan 26, 2021 at 9:59
12

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.

2
  • 3
    I'm not sure why you're downvoted. This is the only thing that worked for me. I would note that it failed silently when I had errors in the Desktop Entry file, but once I had them fixed it worked fine. Jun 8, 2021 at 21:57
  • Same here. It didn't refresh all I needed, but at least it allows me some control which literally none of the other answers gave (NixOs, Wayland + Gnome3)
    – sehe
    Mar 23 at 20:22
1

I tried a few ways, including these posted here, but none worked except this one

gnome-shell --replace & disown
2
  • Well.... this worked but it also pooched my Gnome. I got a 'Oh no! Something has gone wrong' message. But the desktop files were updated :-/ Dec 17, 2020 at 19:58
  • Nix + Wayland + Gnome3: libmutter-Message: 21:22:48.638: Running GNOME Shell (using mutter 45.5) as a Wayland display server Failed to setup: Could not take control: GDBus.Error:System.Error.EBUSY: Device or resource busy
    – sehe
    Mar 23 at 20:23
1

Tried all of the above. Only thing that worked in the end was logging out, and logging back in.

Sometimes it's the simple things that work best.

1
  • 1
    Appreciate this confirmation having reached the end of the list with no reprieve :)
    – sehe
    Mar 23 at 20:24

You must log in to answer this question.

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