15

I need to launch some applications on KDE with some added config changes. The best way to do that without messing up with / is by copying .desktop file of individual applications, that I need to change config of, from /usr/share/applications, add options, and then copy them to ~/.local/share/applications.

I was wondering if that is going to cause any problems that I am not aware of. And if there is a better way to do that say by not copying everything but only adding a changes in the desktop file in ~/.local/share/applications.

Thanks.

  • 1
    Nono! only the specific ones!! – Jacob Vlijm Apr 17 '15 at 16:07
9

Yes it should work to copy the ones you want to modify to ~/.local/share/applications, and shouldn't cause too many problems unless you make some bad edits (e.g. removing mime-types etc). Copying all the ones mean that if they are updated at /usr/share/applications, they won;t be updated in ~/.local/share/applications, and the launchers for apps you remove will remain. Don't bother copying all of them that is unnecessary.

After you make the edits, running update-desktop-database ~/.local/share/applications/ should make sure the new launcher is recognised, so is shown in the Dash/Menu.

Unity's launcher, and probably Gnome's Dash will likely still show the version in /usr/share/applications, so you will need to unlock and lock the icon. Gnome 3 may also need a restart, Nautilus may do as well so logging out and logging back in should fix this.

Reading the following may help with making edits:

  • I wonder in what case would I see dulicate entry for an app that have a desktop file in both /usr/share/applications and ~/.local/share/applications. – Sudhir Khanger Apr 17 '15 at 18:56
  • @donniezazen see: askubuntu.com/a/516346/72216 – Jacob Vlijm Apr 17 '15 at 19:04
  • 1
    @JacobVlijm I see if the filenames are same then the one in ~/.local/share/applications takes precedence. Thanks. – Sudhir Khanger Apr 17 '15 at 19:15
  • @donniezazen something to keep in mind with locally edited .desktop files is that they are not updated if an application is updated (including the global .desktop file), but not the local one. Chrome is famous for that, resulting in duplicate icons. – Jacob Vlijm Apr 17 '15 at 20:14
  • In Ubuntu 18.10, if I copy the Terminal entry org.gnome.Terminal.desktop, then when it opens the modified .desktop from super + search as desired, but the icon shown on the dock for this new modified terminal window still refers to the system .desktop. – Ciro Santilli 新疆改造中心996ICU六四事件 Mar 31 at 12:57
3

Don't copy all files/directories from /usr/share/applications

It is indeed good practice to copy a .desktop file locally before editing it. That is the appropriate procedure. After you copied/edited it and logged out/in, the local one will overrule the global one.

Not all files in /usr/share/applications are meant to be run by the user directly however. Some files possibly are no .desktop files at all and even a few directories may exist. That is (a.o.) why you should not simply copy everything from /usr/share/applications into ~/.local/share/applications.

There is also no reason at all to copy all .desktop files locally. The local ones will only overrule the global ones if the local one exists. If the local one does not exist, the global one still is "in charge".

Is there a risk if I copy the complete contents of /usr/share/applications to ~/.local/share/applications?

Apart from creating useless duplicates, copying everything from /usr/share/applications can cause conflicts starting up your desktop. I actually did that once as an experiment (Unity), had to fix things with a startup usb.

Conclusion:

Only copy global .desktop files to ~/.local/share/applications if you have a reason to do that, and only copy (and edit) files specifically.

If you mess up a .desktop file somehow, the application won't startup from Dash or you are experiencing duplicate icons in Dash, if you do not manage to fix, simply remove the local .desktop, log out/in and things are as they were before.

  • Thanks for the write up. Just to let you know I should have been clearer I have no intention of copying the whole directory. I only meant to copy individual files. – Sudhir Khanger Apr 17 '15 at 18:46
  • 1
    @donniezazen Ah, then it should be fine. In most cases, if you really mess up a .desktop file, simply remove it log, out/in and things are as they were before. – Jacob Vlijm Apr 17 '15 at 18:49
  • Also do not hesitate to remove all .desktop from ~/.local/share/applications if you start to see strange behavior with your applications, browser starting strangely, multiples icons of the same app in the launcher, etc. – Natim Dec 22 '16 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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