diff --git a/lib/menubar/init.lua b/lib/menubar/init.lua index f005439d..a4e68b81 100644 --- a/lib/menubar/init.lua +++ b/lib/menubar/init.lua @@ -39,7 +39,7 @@ local function get_screen(s) end -- menubar -local menubar = { mt = {}, menu_entries = {} } +local menubar = { menu_entries = {} } menubar.menu_gen = require("menubar.menu_gen") menubar.utils = require("menubar.utils") local compute_text_width = menubar.utils.compute_text_width @@ -395,9 +395,18 @@ end -- @param scr Screen. function menubar.show(scr) if not instance then + -- Add to each category the name of its key in all_categories + for k, v in pairs(menubar.menu_gen.all_categories) do + v.key = k + end + + if menubar.cache_entries then + menubar.refresh(scr) + end + instance = { wibox = wibox({ ontop = true }), - widget = menubar.get(scr), + widget = common_args.w, prompt = awful.widget.prompt(), query = nil, count_table = nil, @@ -458,7 +467,9 @@ end --- Get a menubar wibox. -- @tparam[opt] screen scr Screen. -- @return menubar wibox. +-- @deprecated If you know what this actually does, please tell us function menubar.get(scr) + awful.util.deprecate("Use menubar.show() instead", { deprecated_in = 5 }) menubar.refresh(scr) -- Add to each category the name of its key in all_categories for k, v in pairs(menubar.menu_gen.all_categories) do @@ -467,10 +478,11 @@ function menubar.get(scr) return common_args.w end -function menubar.mt.__call(_, ...) +local mt = {} +function mt.__call(_, ...) return menubar.get(...) end -return setmetatable(menubar, menubar.mt) +return setmetatable(menubar, mt) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80