From 27d448bc974fef7cf371f05b76b98a3baf4d2641 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 6 Oct 2010 18:45:50 +0200 Subject: [PATCH] awful.widget.common: Add background to the icon The icon should get the same background everything else gets. Fix this by making the background the outer-most widget in each item. Signed-off-by: Uli Schlachter --- lib/awful/widget/common.lua.in | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/awful/widget/common.lua.in b/lib/awful/widget/common.lua.in index 6d0c5b20c..f162b8843 100644 --- a/lib/awful/widget/common.lua.in +++ b/lib/awful/widget/common.lua.in @@ -50,20 +50,25 @@ function common.list_update(w, buttons, label, data, objects) -- update the widgets, creating them if needed w:reset() for i, o in ipairs(objects) do - local ib, tb, bgb, l - ib = wibox.widget.imagebox() - tb = wibox.widget.textbox() - bgb = wibox.widget.background() + local ib = wibox.widget.imagebox() + local tb = wibox.widget.textbox() + local bgb = wibox.widget.background() local m = wibox.layout.margin() + local l = wibox.layout.fixed.horizontal() + + -- The textbox gets a margin to look better m:set_left(4) m:set_right(4) m:set_widget(tb) - bgb:set_widget(m) - l = wibox.layout.fixed.horizontal() + + -- All of this is added in a fixed widget l:fill_space(true) l:add(ib) - l:add(bgb) - w:add(l) + l:add(m) + + -- And all of this gets a background + bgb:set_widget(l) + w:add(bgb) if buttons then -- Use a local variable so that the garbage collector doesn't strike @@ -83,7 +88,7 @@ function common.list_update(w, buttons, label, data, objects) btns[#btns + 1] = btn end end - l:buttons(btns) + bgb:buttons(btns) end local text, bg, bg_image, icon = label(o)