Centers the middle widget in the align layout in the remaining space
left by the widgets on the sides.

Signed-off-by: Lukáš Hrázký <lukk...@email.cz>
---
 lib/awful/menu.lua.in         | 2 +-
 lib/wibox/layout/align.lua.in | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in
index 772d831..ba92da7 100644
--- a/lib/awful/menu.lua.in
+++ b/lib/awful/menu.lua.in
@@ -560,7 +560,7 @@ function menu.entry(parent, args)
     left:add(margin)
 
     local layout = wibox.layout.align.horizontal()
-    layout:set_middle(left)
+    layout:set_left(left)
     if submenu then
         layout:set_right(submenu)
     end
diff --git a/lib/wibox/layout/align.lua.in b/lib/wibox/layout/align.lua.in
index d4a9517..9c3d1bf 100644
--- a/lib/wibox/layout/align.lua.in
+++ b/lib/wibox/layout/align.lua.in
@@ -56,11 +56,13 @@ function align:draw(wibox, cr, width, height)
     if self.second and size_first + size_third < size_limit then
         local x, y, w, h
         if self.dir == "y" then
-            x, y = 0, size_first
             w, h = width, size_limit - size_first - size_third
+            local _, real_h = self.second:fit(w, h)
+            x, y = 0, size_first + h / 2 - real_h / 2
         else
-            x, y = size_first, 0
             w, h = size_limit - size_first - size_third, height
+            local real_w, _ = self.second:fit(w, h)
+            x, y = size_first + w / 2 - real_w / 2, 0
         end
         base.draw_widget(wibox, cr, self.second, x, y, w, h)
     end
-- 
1.8.1


-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to