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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-06 18:45:50 +02:00
parent 01aa7e66e6
commit 27d448bc97
1 changed files with 14 additions and 9 deletions

View File

@ -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)