From 0411b5f1176e76ea6206ed4e9e926be5c336e748 Mon Sep 17 00:00:00 2001 From: "didier@slint.fr" Date: Thu, 30 Mar 2017 00:36:03 +0200 Subject: [PATCH] Properly handle OnlyShowIn and NotShowIn. OnlyShowIn and NotShowIn relate to a "real" desktop, not a window manager. For instance if the DE is LXDE and OnlyShowIn=LXDE; the desktop entry should be included it the menu, even if a WM like FVWM is used. --- src/xdgmenumaker | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/xdgmenumaker b/src/xdgmenumaker index 9a5a179..42a3755 100755 --- a/src/xdgmenumaker +++ b/src/xdgmenumaker @@ -380,12 +380,11 @@ def get_entry_info(desktopfile, ico_paths=True): notshowin = de.getNotShowIn() hidden = de.getHidden() nodisplay = de.getNoDisplay() - # none of the freedesktop registered environments are supported by - # OnlyShowIn anyway: - # http://standards.freedesktop.org/menu-spec/latest/apb.html - # So if OnlyShowIn is set, it certainly isn't for any of the WMs - # xdgmenumaker supports. - if (onlyshowin != []) or (desktop in notshowin) or hidden or nodisplay: + if 'XDG_CURRENT_DESKTOP' in os.environ and len(onlyshowin) >0 and not os.environ['XDG_CURRENT_DESKTOP'] in onlyshowin: + return None + if 'XDG_CURRENT_DESKTOP' in os.environ and len(notshowin) >0 and os.environ['XDG_CURRENT_DESKTOP'] in notshowin: + return None + if hidden or nodisplay: return None name = de.getName().encode('utf-8')