Hi,

On 26.12.2013 03:51, John Kha wrote:
> This fixes an issue I had trying to nest a horizontal align widget inside a
> vertical flex widget. The align widget was pushing the flex widget to take
> up all the available space inside of another horizontal align widget in
> which it was nested. The problem was that the code used width where it
> should have used height and vis-versa. I've attached the patch and my
> rc.lua that is fixed by this.

I am confused at what this code is trying to do and why it would be doing
something more sensible after your patch than it was doing before.

Let's assume a horizontal align widget (so self.dir == "x"). With the current
code, the align layout asks for all the available width and for as much of the
height as its largest child widget asks for.

With your patch, the code asks for all the available height and as much of the
width as its largest child widget wants.

The align layout has functions like "set_left" and "set_right" functions. So if
you pass a widget to set_right, the expectation should be for this widget to
appear as far right as possible. For this, the align layout has to request as
much space as possible.

This is just what the current code does, I think.

After your patch, the align layout will use all the available height, although
nothing actually wants that space.

So if you want me to merge that patch, I need some better reason to do so.


Now to your issue:
I assume you are talking about this code in your rc.lua (the other vertical flex
layout doesn't do anything with an align layout; the code was simplified a bit):

    -- Widgets that are aligned to the right
    local right_layout_top = wibox.layout.align.horizontal()
    right_layout_top:set_left(wibox.widget.systray())
    right_layout_top:set_right(mylayoutbox[s])

    local right_layout_bottom = wibox.layout.fixed.horizontal()
    right_layout_bottom:add(mytextclock)

    local right_layout_top_container = wibox.layout.constraint()
    right_layout_top_container:set_widget( right_layout_top )
    right_layout_top_container:set_width( 150 )
    right_layout_top_container:set_strategy( 'max' )

    local right_layout = wibox.layout.flex.vertical()
    right_layout:add(right_layout_top)
    right_layout:add(right_layout_bottom)

    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)

So when layout calculates its geometries, the right_layout will ask the
right_layout_top for its width which will then use up all of the available
width. This means that there is no space left for the tasklist.

What you are trying to achieve is that systray is to the top-left of the
textclock while the layoutbox is at the top-right end.

Right? Or is the issue something else?

So what you are trying to achieve is an align layout that doesn't use up all the
available space, but only asks for as few space as possible. So instead of using
the maximum of the width, you want to use the sum of the width of all three 
widgets.

If you want an idea on how to do this, I would suggest a new option in the align
layout. Something like :set_expand(false) (I am open for suggestions for better
names, I only thought about this for 0.5 seconds). The default is true which is
the current behavior. When it is toggle to false, align:fit() would return the
sum of width of its individual widgets instead of the original arguments.

Does this make sense to you and do what you need?

Cheers,
Uli
-- 
Bitte nicht mit dem verbleibenden Auge in den Laser gucken.
 - Vincent Ebert

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

Reply via email to