From cbb8f41261d940df309a2e9e1f6b68c81855f362 Mon Sep 17 00:00:00 2001 From: Michael Perlov Date: Wed, 29 Aug 2018 22:39:07 +0300 Subject: [PATCH 1/2] menubar.utils: Allow to add programs with OnlyShowIn option being set Bug: https://github.com/awesomeWM/awesome/issues/2377 Signed-off-by: Michael Perlov --- lib/menubar/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index d0b9e5e04..e92178f14 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -354,7 +354,7 @@ function utils.parse_desktop_file(file) if program.OnlyShowIn then program.show = false -- Assume false until found for _, wm in ipairs(program.OnlyShowIn) do - if wm == utils.wm_name then + if wm:match(utils.wm_name) then program.show = true break end From b48782671967425618759fc34ce07287547c57a8 Mon Sep 17 00:00:00 2001 From: Michael Perlov Date: Thu, 30 Aug 2018 17:04:37 +0300 Subject: [PATCH 2/2] Check for non-empty utils.wm_name before checking OnlyShowIn attribute Signed-off-by: Michael Perlov --- lib/menubar/utils.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index e92178f14..c51f98b2a 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -350,17 +350,19 @@ function utils.parse_desktop_file(file) -- Only check these values is NoDisplay is true (or non-existent) -- Only show the program if there is no OnlyShowIn attribute - -- or if it contains wm_name - if program.OnlyShowIn then - program.show = false -- Assume false until found - for _, wm in ipairs(program.OnlyShowIn) do - if wm:match(utils.wm_name) then - program.show = true - break + -- or if it contains wm_name or wm_name is empty + if utils.wm_name ~= "" then + if program.OnlyShowIn then + program.show = false -- Assume false until found + for _, wm in ipairs(program.OnlyShowIn) do + if wm == utils.wm_name then + program.show = true + break + end end + else + program.show = true end - else - program.show = true end -- Only need to check NotShowIn if the program is being shown