diff --git a/lib/awful/widget/common.lua.in b/lib/awful/widget/common.lua.in index 70e75c06..801ddc42 100644 --- a/lib/awful/widget/common.lua.in +++ b/lib/awful/widget/common.lua.in @@ -52,14 +52,9 @@ function common.list_update(w, buttons, label, data, objects) local ib = wibox.widget.imagebox() local tb = wibox.widget.textbox() local bgb = wibox.widget.background() - local m = wibox.layout.margin() + local m = wibox.layout.margin(tb, 4, 4) 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) - -- All of this is added in a fixed widget l:fill_space(true) l:add(ib) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index a766cff6..144d953e 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -383,9 +383,7 @@ function notify(args) -- if we have an icon, use it if icon then iconbox = wibox.widget.imagebox() - iconmargin = wibox.layout.margin() - iconmargin:set_widget(iconbox) - iconmargin:set_margins(margin) + iconmargin = wibox.layout.margin(iconbox, margin, margin, margin, margin) local img = icon if type(icon) == "string" then img = capi.oocairo.image_surface_create_from_png(icon) diff --git a/lib/wibox/layout/margin.lua.in b/lib/wibox/layout/margin.lua.in index 1b280010..c0655eae 100644 --- a/lib/wibox/layout/margin.lua.in +++ b/lib/wibox/layout/margin.lua.in @@ -99,8 +99,11 @@ end --- Returns a new margin layout. -- @param widget A widget to use (optional) --- @param margin A margin to use on every side of the widget (optional) -local function new(widget, margin) +-- @param left A margin to use on the left side of the widget (optional) +-- @param right A margin to use on the right side of the widget (optional) +-- @param top A margin to use on the top side of the widget (optional) +-- @param bottom A margin to use on the bottom side of the widget (optional) +local function new(widget, left, right, top, bottom) local ret = widget_base.make_widget() for k, v in pairs(_M) do @@ -113,7 +116,10 @@ local function new(widget, margin) ret:emit_signal("widget::updated") end - ret:set_margins(margin or 0) + ret:set_left(left or 0) + ret:set_right(right or 0) + ret:set_top(top or 0) + ret:set_bottom(bottom or 0) if widget then ret:set_widget(widget)