On Thu, 10 Jan 2013 16:59:16 +0100 Uli Schlachter <psyc...@znc.in>
wrote:

> On 05.01.2013 16:12, Lukáš Hrázký wrote:
> > Centers the middle widget in the align layout in the remaining space
> > left by the widgets on the sides.
> [...]
> > 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
> 
> Another "ARGH": This breaks client moving via clicking on its titlebar. This 
> is
> implemented via :buttons() on the client title widget. Of course, since this
> widget is smaller now, it doesn't receive the mouse click if you are clicking 
> in
> the "empty" area.

ARGH indeed.

> 
> The only idea that I have so far: Wrap the titlewidget in another align layout
> and set the buttons on this one. That way we get both working client moving 
> and
> a centered client title.
> 
> However, this smells a lot like an ugly, ugly hack. Meh.

Welcome to layout nesting abuse, the way it was meant to be :) You can
also put a flex layout into align's middle widget (_the_ layout to use
if you want to stretch something to use all the space, if you have one
widget or more, imo) and put only the title in it. If you want it
centered, title:set_align("center") (or how does it go)?

> 
> Uli
> -- 
> "Why make things difficult, when it is possible to make them cryptic
> and totally illogical, with just a little bit more effort?" -- A. P. J.
> 
> -- 
> To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

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

Reply via email to