appmenus: ignore entries with NoDisplay=true

According to Desktop Entry Specification:
NoDisplay means "this application exists, but don't display it in the
menus". This can be useful to e.g. associate this application with MIME
types, so that it gets launched from a file manager (or other apps),
without having a menu entry for it (there are tons of good reasons
for this, including e.g. the netscape -remote, or kfmclient openURL kind
of stuff).

Apparently over half of desktop files in default Fedora template have
NoDisplay=true...

Fixes QubesOS/qubes-issues#1348
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-03 00:48:26 +01:00
parent 8f99cb5759
commit 7bc6422f53
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1,2 +1,9 @@
find /usr/share/applications/ /usr/local/share/applications/ -name '*.desktop' 2>/dev/null | \
xargs awk '/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile } /^Exec=/ { print FILENAME ":Exec=qubes-desktop-run " FILENAME; next } /=/ {print FILENAME ":" $0 }' 2> /dev/null
xargs awk '
BEGINFILE { entry="" }
/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile }
/^Exec=/ { entry = entry FILENAME ":Exec=qubes-desktop-run " FILENAME "\n"; next }
/^NoDisplay *= *true$/ { entry=""; nextfile }
/=/ { entry = entry FILENAME ":" $0 "\n" }
ENDFILE { print entry }
' 2> /dev/null