From 7bc6422f5309721419e1554fe2e1c7c5565b0697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 3 Nov 2015 00:48:26 +0100 Subject: [PATCH] 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 --- qubes-rpc/qubes.GetAppmenus | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qubes-rpc/qubes.GetAppmenus b/qubes-rpc/qubes.GetAppmenus index 76a1115..5df889e 100644 --- a/qubes-rpc/qubes.GetAppmenus +++ b/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