Explorar o código

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
Marek Marczykowski-Górecki %!s(int64=8) %!d(string=hai) anos
pai
achega
7bc6422f53
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      qubes-rpc/qubes.GetAppmenus

+ 8 - 1
qubes-rpc/qubes.GetAppmenus

@@ -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