awful.widget: Add an helper to set a property on all template widgets
With this helper, it becomes possible to avoid manually setting common properties such as the client in the tasklist of tag in the taglist when the children widgets of the template have a set_+property_name.
This commit is contained in:
parent
e79a5c5988
commit
d5a2fe0072
|
@ -91,6 +91,19 @@ local function default_template()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Find all the childrens (without the hierarchy) and set a property.
|
||||||
|
function common._set_common_property(widget, property, value)
|
||||||
|
if widget["set_"..property] then
|
||||||
|
widget["set_"..property](widget, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
if widget.get_children then
|
||||||
|
for _, w in ipairs(widget:get_children()) do
|
||||||
|
common._set_common_property(w, property, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Common update method.
|
--- Common update method.
|
||||||
-- @param w The widget.
|
-- @param w The widget.
|
||||||
-- @tab buttons
|
-- @tab buttons
|
||||||
|
|
Loading…
Reference in New Issue