tasklist: Auto-call set_client on all template widgets
This commit also update one of the example to remove its now redundant boilerplate code.
This commit is contained in:
parent
aa6ab69ffc
commit
a081413339
|
@ -401,6 +401,11 @@ local function tasklist_label(c, args, tb)
|
|||
return text, bg, bg_image, not tasklist_disable_icon and c.icon or nil, other_args
|
||||
end
|
||||
|
||||
-- Remove some callback boilerplate from the user provided templates.
|
||||
local function create_callback(w, t)
|
||||
common._set_common_property(w, "client", t)
|
||||
end
|
||||
|
||||
local function tasklist_update(s, w, buttons, filter, data, style, update_function, args)
|
||||
local clients = {}
|
||||
|
||||
|
@ -419,6 +424,7 @@ local function tasklist_update(s, w, buttons, filter, data, style, update_functi
|
|||
|
||||
update_function(w, buttons, label, data, clients, {
|
||||
widget_template = args.widget_template,
|
||||
create_callback = create_callback,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -52,17 +52,11 @@ end --DOC_HIDE
|
|||
widget = wibox.container.background,
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "clienticon",
|
||||
widget = awful.widget.clienticon,
|
||||
},
|
||||
awful.widget.clienticon,
|
||||
margins = 5,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
create_callback = function(self, c, index, objects) --luacheck: no unused args
|
||||
self:get_children_by_id("clienticon")[1].client = c
|
||||
end,
|
||||
layout = wibox.layout.align.vertical,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue