Local desktop file does not override global desktop file's options

I want to add some custom options when running VS Code, so I tried to override the global Exec settings of the desktop file by editing the application entry shown in the KDE application launcher (I use the KDE spin of Fedora). I tried to modify the “Command” section in the figure below:

But after I clicked “OK” and re-open the settings of the application entry, the Command field still has the original value. I’ve checked the ~/.local/share/applications directory and a new desktop file called code.desktop is created with the correct Exec value, so I think the problem is that the local desktop file does not override the global desktop file located at /usr/share/applications. Also, in the KDE application launcher the location of the VS Code desktop file is still /usr/share/applications instead of my local version. What could cause this problem, and how can I solve it?

An additional information which might help is that I manally created a desktop file for my MATLAB installation and put it in ~/.local/share/applications, and that file is correctly recognized by KDE.

1 Like

It sometimes requires relogin to apply changes.
However this method always works for me:

desktop-file-install \
--dir=${HOME}/.local/share/applications \
--set-key=Exec \
--set-value="command --options args" \
1 Like

Thanks for your reply! For me the local desktop file does not override the global file even after restart, which is quite weird… On the other hand, if I add a hand-written desktop file for an application installed in my home folder (no global desktop files exist for it), it is immediately reflected in the application launcher after the desktop file is created. I guess this may be a bug of KDE Plasma and less related to the desktop files themselves. Should I report this to the KDE dev team instead?

1 Like