How to force Unity reload ~/.local/share/applications/

Let's say I changed/added some myapp.desktop file at ~/.local/share/applications/. For some time Ubuntu Unity will still show me old applications shortcuts at Unity lens under Ubuntu button. It will take some time (or just a one restart) to get applications list updated there.

How I can force Unity reload ~/.local/share/applications and reflect shortcuts correctly in lens?


Solution 1:

A little late, but i stumbled upon this thread before finding a solution, atleast to my problem, googling something related, nearly giving up.

As per this guide help.ubuntu.com, don't just edit or create your .desktop files in /usr/local/share/applications or ~/.local/share/applications. Instead, create the file somewhere else and use

desktop-file-install <your_file.desktop>

to add the file.

E.g. you create ~/myapp.desktop and do

desktop-file-install --dir=$HOME/.local/share/applications ~/myapp.desktop

Existing files of the same name will be overwritten and unity updated, you can use --delete-original if the source is not needed anymore, or

sudo desktop-file-install ~/myapp.desktop

to install it for all users.

Solution 2:

The way to do this is to run the command

killall unity-scope-home

after opening the dash the process is started automatically again.

The correct icons are then displayed...

Solution 3:

sudo update-desktop-database will refresh the .desktop database.

Solution 4:

According with this answer (and you can find many others in the same sense), unfortunately there seems to be no command to let the unity-applications-daemon refresh its application cache. But I can confirm that unity will automatically detect any changes with .desktop files in ~/.local/share/applications. If these changes are not immediately available, try logging out and in again to refresh it.