diff --git a/lib/awful/widget/layout/horizontal.lua.in b/lib/awful/widget/layout/horizontal.lua.in index 5f518fd9e..2e7bf6d72 100644 --- a/lib/awful/widget/layout/horizontal.lua.in +++ b/lib/awful/widget/layout/horizontal.lua.in @@ -61,10 +61,13 @@ local function horizontal(direction, bounds, widgets, screen) height = 0, } end - g.ratio = 1 - if g.height > 0 then - g.ratio = g.width / g.height + + if v.resize and g.width > 0 and g.height > 0 then + local ratio = g.width / g.height + g.width = math.floor(bounds.height * ratio) + g.height = bounds.height end + if g.width > bounds.width then g.width = bounds.width end @@ -76,10 +79,6 @@ local function horizontal(direction, bounds, widgets, screen) g.y = 0 end - if v.resize and g.width > 0 then - g.width = math.floor(g.height * g.ratio) - end - if direction == "leftright" then if margins[v] then g.x = x + (margins[v].left or 0)