------------------------------------------------- -- @author Gregor Best , Lukas Hrazky -- @copyright 2009 Gregor Best, Lukas Hrazky -- @release @AWESOME_VERSION@ ------------------------------------------------- local require = require local ipairs = ipairs local pairs = pairs local util = require("awful.util") local layout = require("awful.widget.layout") local linear = require("awful.widget.layout.linear_common") --- Vertical widget layouts module("awful.widget.layout.vertical") -- index used for vertical layouts local idx = layout.switched_index --- Places the widgets in a column, aligned to the top. -- It recognizes the following attributes in the encompassing table: --

width: Maximum width of the layout. If set, all widgets are resized to this width. -- (optional)
-- height: Height of the layout. (optional)

-- @param bounds The geometry of the bounds for the layout. -- @param widgets The table of the widgets to layout. When layout function is placed in -- a table, it is the table that is passed as this argument. -- @param screen The screen of the wibox. -- @return A table of geometries of all the widgets. function topdown(bounds, widgets, screen) return linear.fixed(idx, bounds, widgets, screen) end --- Places the widgets in a column, aligned to the bottom. -- It recognizes the following attributes in the encompassing table: --

width: Maximum width of the layout. If set, all widgets are resized to this width. -- (optional)
-- height: Height of the layout. (optional)

-- @param bounds The geometry of the bounds for the layout. -- @param widgets The table of the widgets to layout. When layout function is placed in -- a table, it is the table that is passed as this argument. -- @param screen The screen of the wibox. -- @return A table of geometries of all the widgets. function bottomup(bounds, widgets, screen) local g = linear.fixed(idx, util.table.clone(bounds), widgets, screen) for _, w in pairs(g) do w.y = w.y + bounds.height - g.total.height end return g end --- Places the widgets in a column, aligned to the center. -- It recognizes the following attributes in the encompassing table: --

width: Maximum width of the layout. If set, all widgets are resized to this width. -- (optional)
-- height: Height of the layout. (optional)

-- The widgets will be placed in the center of the free space that is left after all widgets -- preceding the table with this layout were placed. The area covered by widgets with this layout -- is not subtracted from the total free area (so the widgets "cover no space"). Therefore, if you -- put anything after a table with center layout, the widgets may overlap. -- @param bounds The geometry of the bounds for the layout. -- @param widgets The table of the widgets to layout. When layout function is placed in -- a table, it is the table that is passed as this argument. -- @param screen The screen of the wibox. -- @return A table of geometries of all the widgets. function center(bounds, widgets, screen) local g = linear.fixed(idx, util.table.clone(bounds), widgets, screen) for _, w in ipairs(g) do w.y = w.y + (bounds.height - g.total.height) / 2 end -- if height is set for widgets table, make total this wide, -- otherwise move total.y to reflect new position if widgets.height then g.total.height = widgets.height else g.total.y = g.total.y + (bounds.height - g.total.height) / 2 end return g end --- Places the widgets in a column, making them equally high. -- It recognizes the following attributes in the encompassing table: --

width: Maximum width of the layout. If set, all widgets are resized to this width. -- (optional)
-- height: Height of the layout. (optional)
-- max_size: Maximum height of one item. If not set, widgets' heights are set so that they always -- cover all available space. (optional)
-- gap: Gap between the widgets. (optional)

-- @param bounds The geometry of the bounds for the layout. -- @param widgets The table of the widgets to layout. When layout function is placed in -- a table, it is the table that is passed as this argument. -- @param screen The screen of the wibox. -- @return A table of geometries of all the widgets. function flex(bounds, widgets, screen) return linear.flex(idx, bounds, widgets, screen) end -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80