Sample Header Ad - 728x90

overriding a single field in a desktop-entry

3 votes
2 answers
2379 views
I'm setting up a Debian system, with LXDE as the Desktop Environment (really, I'm just remastering a *Raspberry Pi OS* image). I have an application that ships with a [.desktop](https://specifications.freedesktop.org/desktop-entry-spec/latest/) file. Cool! Unfortunately that MyApplication.desktop file contains the following line that prevents the icon from being shown in the menu:
NoDisplay=true
Now, I would like to find a generic way to override just this single field in the MyApplication.desktop file for the entire system, without touching any other fields - think of it as an overlay. Especially, I try to *avoid* a solution like this...
sed -e 's/^NoDisplay=true/NoDisplay=false/' /usr/share/applications/MyApplication.desktop \
    > /usr/local/share/applications/MyApplication.desktop
... as this would lose any changes of the MyApplication.desktop introduced by newer upstream versions of that file (and presumable leave the menu-entry intact, even if after I've uninstalled MyApplication from the system) Obviously, the standard does not allow only partial .desktop files, e.g. this would not work:
$ cat /usr/share/applications/MyApplication.desktop
[Desktop Entry]
Name=My Cool Application
GenericName=My Application
Exec=myapp %f
Icon=myapp
Type=Application
Terminal=false
Categories=Application
NoDisplay=true

$ cat /usr/local/share/applications/MyApplication.desktop
[Desktop Entry]
NoDisplay=false
Similarily, there's no include mechanism:
$ cat /usr/local/share/applications/MyApplication.desktop
include=/usr/share/applications/MyApplication.desktop
[Desktop Entry]
NoDisplay=false
what are my options to achieve that?
Asked by umläute (6704 rep)
Sep 21, 2021, 08:10 AM
Last activity: Aug 28, 2023, 06:56 PM