diff --git a/lib/awful/widget/common.lua b/lib/awful/widget/common.lua index 62b791c89..8649dad08 100644 --- a/lib/awful/widget/common.lua +++ b/lib/awful/widget/common.lua @@ -38,32 +38,6 @@ function common.create_buttons(buttons, object) end end -local function default_template() - local ib = wibox.widget.imagebox() - local tb = wibox.widget.textbox() - local bgb = wibox.container.background() - local tbm = wibox.container.margin(tb, dpi(4), dpi(4)) - local ibm = wibox.container.margin(ib, dpi(4)) - local l = wibox.layout.fixed.horizontal() - - -- All of this is added in a fixed widget - l:fill_space(true) - l:add(ibm) - l:add(tbm) - - -- And all of this gets a background - bgb:set_widget(l) - - return { - ib = ib, - tb = tb, - bgb = bgb, - tbm = tbm, - ibm = ibm, - primary = bgb, - } -end - local function custom_template(args) local l = base.make_widget_from_value(args.widget_template) @@ -84,6 +58,38 @@ local function custom_template(args) } end +local function default_template() + return custom_template { + widget_template = { + id = 'background_role', + widget = wibox.container.background, + { + widget = wibox.layout.fixed.horizontal, + fill_space = true, + { + id = 'icon_margin_role', + widget = wibox.container.margin, + { + id = 'icon_role', + widget = wibox.widget.imagebox, + left = dpi(4), + }, + }, + { + id = 'text_margin_role', + widget = wibox.container.margin, + left = dpi(4), + right = dpi(4), + { + id = 'text_role', + widget = wibox.widget.textbox, + }, + } + } + } + } +end + --- Common update method. -- @param w The widget. -- @tab buttons