Can ~/.local/share/applications override /usr/share/applications?
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.
Solution 1:
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:
- http://standards.freedesktop.org/desktop-entry-spec/latest/
- https://wiki.archlinux.org/index.php/Desktop_entries
Solution 2:
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.