From ede64dd30812257c237e939f0daf17c1a8ca8324 Mon Sep 17 00:00:00 2001 From: SkyyySi Date: Fri, 30 Sep 2022 16:02:37 +0200 Subject: [PATCH 1/2] (BREAKING CHANGE) fix menubar.utils.parse_desktop_file [Actions] --- lib/menubar/utils.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index 77945a398a..96a3d77696 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -283,6 +283,26 @@ function utils.parse_desktop_file(file) program[key] = getter(keyfile, key) end + -- By default, only the identifier of each action is added to `program`. + -- This will replace those actions with a (localized) table holding the + -- "actual" action data, including its Exec and Icon. + -- See https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#extra-actions + if program.Actions then + local corrected_actions = {} + local cur_action + + for _, action in pairs(program.Actions) do + cur_action = "Desktop Action "..action + corrected_actions[action] = {} + + for _, key in pairs(keyfile:get_keys(cur_action)) do + corrected_actions[action][key] = keyfile:get_locale_string(cur_action, key, nil) + end + end + + program.Actions = corrected_actions + end + -- In case the (required) 'Name' entry was not found if not program.Name or program.Name == '' then return nil end From 75efe29a9a8e557e5db5b4ce20e3240ed6ca9a5e Mon Sep 17 00:00:00 2001 From: SkyyySi Date: Fri, 30 Sep 2022 17:30:45 +0200 Subject: [PATCH 2/2] Removed a redundant nil --- 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 96a3d77696..e141660db3 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -296,7 +296,7 @@ function utils.parse_desktop_file(file) corrected_actions[action] = {} for _, key in pairs(keyfile:get_keys(cur_action)) do - corrected_actions[action][key] = keyfile:get_locale_string(cur_action, key, nil) + corrected_actions[action][key] = keyfile:get_locale_string(cur_action, key) end end