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?

  • Have you tried unity --reset? – sayantankhan Nov 12 '13 at 15:36
  • Correction. It should just be unity. Press alt+F2 and type in the command. – sayantankhan Nov 12 '13 at 15:41
  • Yes. It didn't help. It still shows old application name after unity or unity --reset (which was before I modified myapp.desktop file). – vladimir Nov 12 '13 at 16:55
  • Odd, it seems to be working fine when I do the exact same thing you're doing. Have made sure the .desktop file is executable? – sayantankhan Nov 12 '13 at 17:26
  • It works only after log off/restart. Try just to change the name of existing application inside the desktop file. Don't change anything else. For ex, add " Test" to the name of some existing app. Now press Ubuntu button and start typing application name - it still shows old name without " Test" for me. I reproduced it on both work and home machines and on wife's laptop. I think it's about 100% reproducable. – vladimir Nov 12 '13 at 18:26
up vote 57 down vote accepted

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=~/.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.

  • +1 this works. A rough edit script using this recipe is at gist.github.com/hilbix/f468fcbb15c3f68670d8 – Tino May 25 '14 at 9:51
  • 4
    just putting a copy of the .desktop file in ~/.local/share/applications worked for me- – chrismarx Mar 18 '15 at 14:01
  • I usually manually edit the file and add it to .local/share/applications/. Tried using the command with --delete-original and I got a warning: warning: key "Keywords[uk]" is a list and does not have a semicolon as trailing character, fixing. The result was the source file deleted and nothing copied to the target directory. Evil OS... basically nuked my file and I had to create a new one from scratch. – Daniel Mar 9 '17 at 11:00
  • 2
    I still get the issue OP noticed even when doing this. – JAB Mar 28 '17 at 16:22
  • I also still get the issue OP noticed even when doing this (and even after restarting) (Ubuntu 16.04). – Dan Nissenbaum Jul 22 '17 at 18:05

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

  • 1
    Does not work at my side. I removed a .desktop file and it still shows up in compiz launch bar. – Tino May 25 '14 at 8:35
  • Well, stuck with BUG 1287663 the solution was to use gsettings set followed by ( unity --replace & ) – Tino May 25 '14 at 10:24
  • I don't know what you mean with compiz launch bar?! I thought you were talking about the dash? – wa4557 May 26 '14 at 11:19
  • Works fine for me, Applications are listed again – Sjaak Trekhaak Nov 20 '14 at 15:14
  • Any alternatives in 15.10? I'm getting unity-scope-home: no process found – ardila Nov 30 '15 at 20:17

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.

  • 3
    Yeah, it will automatically detect .... in an hour ... – vladimir Nov 12 '13 at 18:28
  • @vladimir As I said, if you want the changes immediately available, try logging out and in again to refresh it. – Radu Rădeanu Nov 12 '13 at 18:29
  • 3
    I fully got your answer and probably will accept it. You understand downsides of logging off - all opened apps closed. It's not a solution, it's a workaround and not a user friendly one. Are you developer by any chance? If yes, could you please point me to the daemon sources? I guess this is it: unity-lens-applications daemon.vala – vladimir Nov 12 '13 at 21:28

update-desktop-database is the command to refresh the .desktop database.

  • This didn't work for me. Running Ubuntu 16.04. I still don't see on the launcher icon the changes made in the .desktop file. – RichArt Nov 24 '17 at 22:02
  • 1
    This command only updates MIME type databases. It does not update any other changes. See: manpages.ubuntu.com/manpages/zesty/man1/… – hife Dec 5 '17 at 15:47

Some applications might stop working properly after this command. Chrome, for example, became totally black.

unity --replace
  • Could you clarify your warning(?)? – Zanna Apr 3 '17 at 16:28

I had a similar issue, fixed when restart. I use ubuntu 16.04

I usually create .desktop files in /usr/share/applications/ if I want to share the desktop files with other users and ~/.local/share/applications if for only one user. And I usually restart.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.