diff --git a/README.md b/README.md index 98e9bdc..8ba80e9 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,9 @@ here is the list: | Name | Description | Arguments | Return | | ----------------- | -------------------------------------------- | --------------------- | ------ | | add_item | Add new item to a menu | array of options | item | +| add_items | Add new items to a menu | array of items arrays | array | | add_widget | Add a new widget instead of an item | a widget, args | --- | +| add_widgets | Add new widgets | array of widgets | --- | | add_embeded_menu | Add an inline menu to another menu | an "embed" menu | --- | | add_key_binding | Add a global key binding to a menu | mod array, key | --- | | add_key_hook | Add a callback when a key is pressed | mod, key, event, func | --- | diff --git a/bar.lua b/bar.lua index 521cbaa..8eab9b1 100644 --- a/bar.lua +++ b/bar.lua @@ -117,7 +117,7 @@ local function setup_buttons(data,item,args) -- Setup sub_menu if (item.sub_menu_m or item.sub_menu_f) and data.sub_menu_on >= base.event.BUTTON1 and data.sub_menu_on <= base.event.BUTTON3 then - buttons[data.sub_menu_on] = item.widget:set_menu(item.sub_menu_m or item.sub_menu_f,data.sub_menu_on) + item.widget:set_menu(item.sub_menu_m or item.sub_menu_f,data.sub_menu_on) end -- Scrool up diff --git a/base.lua b/base.lua index c60d09a..5a72ce4 100644 --- a/base.lua +++ b/base.lua @@ -200,6 +200,14 @@ local function add_item(data,args) return item end +local function add_items(data,items) + local ret = {} + for k,item in ipairs(items) do + ret[k] = data:add_item(item) + end + return ret +end + local function add_widget(data,widget,args) args = args or {} @@ -237,6 +245,12 @@ local function add_widget(data,widget,args) end end +local function add_widgets(data,widgets) + for k,item in ipairs(widgets) do + data:add_widget(item) + end +end + local function add_prefix_widget(data,widget,args) data:emit_signal("prefix_widget::added",widget,args) end @@ -356,7 +370,7 @@ local function new(args) }) internal.private_data = private_data data.add_item,data.add_widget,data.add_embeded_menu,data._internal,data.add_key_binding = add_item,add_widget,add_embeded_menu,internal,add_key_binding - data.add_prefix_widget,data.add_suffix_widget=add_prefix_widget,add_suffix_widget + data.add_prefix_widget,data.add_suffix_widget,data.add_items,data.add_widgets=add_prefix_widget,add_suffix_widget,add_items,add_widgets theme.setup_colors(data,args) -- Getters diff --git a/impl/tasklist/init.lua b/impl/tasklist/init.lua index 993cfa8..920f097 100644 --- a/impl/tasklist/init.lua +++ b/impl/tasklist/init.lua @@ -242,7 +242,6 @@ local function tagged(c,t) end local function new(screen) - print("ICIT",beautiful.tasklist_default_item_margins) local args = { select_on = radical.base.event.NEVER , disable_markup = true ,