grid: Apply Awesome v4.2 naming conventions.

* Stop using top level properties for vertical/horizontal
* No abbreviations
* Use height/width instead of size
* Don't use methods where properties can be used
This commit is contained in:
Emmanuel Lepage Vallee 2022-12-04 22:53:21 -08:00
parent f8f5e2c69b
commit 956bd96e94
30 changed files with 370 additions and 218 deletions

View File

@ -89,6 +89,9 @@ This document was last updated at commit v4.3-197-g9085ed631.
* Pango 1.44 is now the oldest recommended Pango version. Older versions are * Pango 1.44 is now the oldest recommended Pango version. Older versions are
still supported, but will lack the ability to use some textbox properties, still supported, but will lack the ability to use some textbox properties,
mainly `wibox.widget.textbox.line_spacing_factor`. mainly `wibox.widget.textbox.line_spacing_factor`.
* The `wibox.layout.grid` layout `expand`, `spacing` and `homogeneous`
property getters now return a table instead of a number. The table contains
a `horizontal` and a `vertical` key.
<a name="v43"></a> <a name="v43"></a>
# Awesome window manager framework version 4.3 changes # Awesome window manager framework version 4.3 changes

View File

@ -32,16 +32,16 @@ local math = math
local gtable = require("gears.table") local gtable = require("gears.table")
local gmath = require("gears.math") local gmath = require("gears.math")
local gcolor = require("gears.color") local gcolor = require("gears.color")
local gdebug = require("gears.debug")
local base = require("wibox.widget.base") local base = require("wibox.widget.base")
local cairo = require("lgi").cairo local cairo = require("lgi").cairo
local grid = { mt = {} } local grid = { mt = {} }
local properties = { local properties = {
"orientation", "superpose", "orientation", "superpose",
"forced_num_rows", "forced_num_cols", "forced_row_count", "forced_column_count",
"min_cols_size", "min_rows_size", }
}
local dir_properties = { "spacing", "homogeneous", "expand" } local dir_properties = { "spacing", "homogeneous", "expand" }
@ -70,7 +70,10 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
-- @property superpose -- @property superpose
--- Force the number of rows of the layout. --- Force the number of rows of the layout.
-- @property forced_num_rows --
-- Deprecated, use `row_count`.
--
-- @deprecatedproperty forced_num_rows
-- @tparam[opt=nil] number|nil forced_num_rows -- @tparam[opt=nil] number|nil forced_num_rows
-- @propertytype nil Automatically determine the number of rows. -- @propertytype nil Automatically determine the number of rows.
-- @propertyunit rows -- @propertyunit rows
@ -79,7 +82,10 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
-- @see row_count -- @see row_count
--- Force the number of columns of the layout. --- Force the number of columns of the layout.
-- @property forced_num_cols --
-- Deprecated, use `column_count`.
--
-- @deprecatedproperty forced_num_cols
-- @tparam[opt=nil] number|nil forced_num_cols -- @tparam[opt=nil] number|nil forced_num_cols
-- @propertytype nil Automatically determine the number of columns.' -- @propertytype nil Automatically determine the number of columns.'
-- @propertyunit columns -- @propertyunit columns
@ -90,23 +96,46 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
--- Set the minimum size for the columns. --- Set the minimum size for the columns.
-- --
--@DOC_wibox_layout_grid_min_size_EXAMPLE@ --@DOC_wibox_layout_grid_min_size_EXAMPLE@
-- @tparam[opt=0] number min_cols_size Minimum size of the columns. -- @tparam[opt=0] number minimum_column_width Minimum size of the columns.
-- @property min_cols_size -- @property minimum_column_width
-- @propertyunit pixel -- @propertyunit pixel
-- @negativeallowed false -- @negativeallowed false
-- @see min_rows_size -- @see minimum_row_height
--- Set the minimum size for the columns.
--
-- Deprecated, use `minimum_column_width`.
--
--@DOC_wibox_layout_grid_min_size_EXAMPLE@
-- @tparam[opt=0] number min_cols_size Minimum size of the columns.
-- @deprecatedproperty min_cols_size
-- @propertyunit pixel
-- @negativeallowed false
-- @see minimum_row_height
--- Set the minimum size for the rows. --- Set the minimum size for the rows.
-- @tparam[opt=0] number minimum_row_height Minimum size of the rows.
-- @property minimum_row_height
-- @propertyunit pixel
-- @negativeallowed false
-- @see min_cols_size
--- Set the minimum size for the rows.
--
-- Deprecated, use `minimum_row_height`.
--
-- @tparam[opt=0] number min_rows_size Minimum size of the rows. -- @tparam[opt=0] number min_rows_size Minimum size of the rows.
-- @property min_rows_size -- @deprecatedproperty min_rows_size
-- @propertyunit pixel -- @propertyunit pixel
-- @negativeallowed false -- @negativeallowed false
-- @see min_cols_size -- @see min_cols_size
--- The spacing between columns. --- The spacing between columns.
-- --
-- Deprecated, use `spacing`.
--
-- @tparam[opt=0] number horizontal_spacing -- @tparam[opt=0] number horizontal_spacing
-- @property horizontal_spacing -- @deprecatedproperty horizontal_spacing
-- @propertyunit pixel -- @propertyunit pixel
-- @negativeallowed false -- @negativeallowed false
-- @see spacing -- @see spacing
@ -114,8 +143,10 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
--- The spacing between rows. --- The spacing between rows.
-- --
-- Deprecated, use `spacing`.
--
-- @tparam[opt=0] number vertical_spacing -- @tparam[opt=0] number vertical_spacing
-- @property vertical_spacing -- @deprecatedproperty vertical_spacing
-- @propertyunit pixel -- @propertyunit pixel
-- @negativeallowed false -- @negativeallowed false
-- @see spacing -- @see spacing
@ -133,23 +164,34 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
-- --
-- @DOC_wibox_layout_grid_border_width3_EXAMPLE@ -- @DOC_wibox_layout_grid_border_width3_EXAMPLE@
-- --
-- @tparam[opt=0] number spacing
-- @property spacing -- @property spacing
-- @tparam[opt=0] number|table spacing
-- @tparam number spacing.vertical The vertical spacing.
-- @tparam number spacing.horizontal The horizontal spacing.
-- @propertytype number The same value for the `"vertical"` and `"horizontal"`
-- aspects.
-- @propertytype table Different values for the `"vertical"` and `"horizontal"`
-- aspects.
-- @propertyunit pixel
-- @negativeallowed false -- @negativeallowed false
-- @see vertical_spacing -- @see vertical_spacing
-- @see horizontal_spacing -- @see horizontal_spacing
--- Controls if the columns are expanded to use all the available width. --- Controls if the columns are expanded to use all the available width.
-- --
-- Deprecated, use `expand`.
--
-- @tparam[opt=false] boolean horizontal_expand Expand the grid into the available space -- @tparam[opt=false] boolean horizontal_expand Expand the grid into the available space
-- @property horizontal_expand -- @deprecatedproperty horizontal_expand
-- @see expand -- @see expand
-- @see vertical_expand -- @see vertical_expand
--- Controls if the rows are expanded to use all the available height. --- Controls if the rows are expanded to use all the available height.
-- --
-- Deprecated, use `expand`.
--
-- @tparam[opt=false] boolean vertical_expand Expand the grid into the available space -- @tparam[opt=false] boolean vertical_expand Expand the grid into the available space
-- @property vertical_expand -- @deprecatedproperty vertical_expand
-- @see expand -- @see expand
-- @see horizontal_expand -- @see horizontal_expand
@ -159,28 +201,34 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
-- preferred `orientation`. -- preferred `orientation`.
-- --
--@DOC_wibox_layout_grid_expand_EXAMPLE@ --@DOC_wibox_layout_grid_expand_EXAMPLE@
-- @tparam[opt=false] boolean expand Expand the grid into the available space
-- @property expand -- @property expand
-- @tparam[opt=false] boolean|table expand Expand the grid into the available space
-- @tparam boolean expand.vertical The vertical expand.
-- @tparam boolean expand.horizontal The horizontal expand.
-- @propertytype number The same value for the `"vertical"` and `"horizontal"`
-- aspects.
-- @propertytype table Different values for the `"vertical"` and `"horizontal"`
-- aspects.
-- @see horizontal_expand -- @see horizontal_expand
-- @see vertical_expand -- @see vertical_expand
--- Controls if the columns all have the same width or if the width of each --- Controls if the columns all have the same width or if the width of each
-- column depends on the content. -- column depends on the content.
-- --
-- see `homogeneous` -- Deprecated, use `homogeneous`
-- --
-- @tparam[opt=true] boolean horizontal_homogeneous All the columns have the same width. -- @tparam[opt=true] boolean horizontal_homogeneous All the columns have the same width.
-- @property horizontal_homogeneous -- @deprecatedproperty horizontal_homogeneous
-- @see vertical_homogeneous -- @see vertical_homogeneous
-- @see homogeneous -- @see homogeneous
--- Controls if the rows all have the same height or if the height of each row --- Controls if the rows all have the same height or if the height of each row
-- depends on the content. -- depends on the content.
-- --
-- see `homogeneous` -- Deprecated, use `homogeneous`
-- --
-- @tparam[opt=true] boolean vertical_homogeneous All the rows have the same height. -- @tparam[opt=true] boolean vertical_homogeneous All the rows have the same height.
-- @property vertical_homogeneous -- @deprecatedproperty vertical_homogeneous
-- @see homogeneous -- @see homogeneous
-- @see horizontal_homogeneous -- @see horizontal_homogeneous
@ -191,29 +239,37 @@ local dir_properties = { "spacing", "homogeneous", "expand" }
-- by the preferred `orientation`. -- by the preferred `orientation`.
-- --
--@DOC_wibox_layout_grid_expand_EXAMPLE@ --@DOC_wibox_layout_grid_expand_EXAMPLE@
-- @tparam[opt=true] boolean homogeneous All the columns/rows have the same size.
-- @property homogeneous -- @property homogeneous
-- @tparam[opt=true] boolean|table homogeneous All the columns/rows have the same size.
-- @tparam boolean homogeneous.vertical The vertical homogeneous value.
-- @tparam boolean homogeneous.horizontal The horizontal homogeneous value.
-- @propertytype number The same value for the `"vertical"` and `"horizontal"`
-- aspects.
-- @propertytype table Different values for the `"vertical"` and `"horizontal"`
-- aspects.
-- @see vertical_homogeneous -- @see vertical_homogeneous
-- @see horizontal_homogeneous -- @see horizontal_homogeneous
--- The number of rows. --- The number of rows.
-- --
-- If `forced_num_rows` is set, then its value is returned, otherwise it will -- Unless manually set, the value will be automatically determined base on the
-- return the maximum actual number of widgets in a row. -- `orientation`.
-- --
-- @property row_count -- @property row_count
-- @tparam integer row_count -- @tparam integer row_count
-- @readonly -- @negativeallowed false
-- @propertydefault autogenerated
-- @see forced_num_rows -- @see forced_num_rows
--- The number of columns. --- The number of columns.
-- --
-- If `forced_num_cols` is set, then its value is returned, otherwise it will -- Unless manually set, the value will be automatically determined base on the
-- return the maximum actual number of widgets in a column. -- `orientation`.
-- --
-- @property column_count -- @property column_count
-- @readonly
-- @tparam integer column_count -- @tparam integer column_count
-- @negativeallowed false
-- @propertydefault autogenerated
-- @see forced_num_cols -- @see forced_num_cols
--- Child widget position. Return of `get_widget_position`. --- Child widget position. Return of `get_widget_position`.
@ -286,8 +342,10 @@ local function find_widget(widgets_table, widget)
end end
--- Get the number of rows and columns occupied by the widgets in the grid. --- Get the number of rows and columns occupied by the widgets in the grid.
-- @method get_dimension -- @deprecatedmethod get_dimension
-- @treturn number,number The number of rows and columns -- @treturn number,number The number of rows and columns
-- @see row_count
-- @see column_count
function grid:get_dimension() function grid:get_dimension()
return self._private.num_rows, self._private.num_cols return self._private.num_rows, self._private.num_cols
end end
@ -377,9 +435,11 @@ end
--- Add a widget to the grid layout at specific coordinate. --- Add a widget to the grid layout at specific coordinate.
-- --
-- You can now use `:add {row_index = 1, col_index = 1}` instead of this method.
--
--@DOC_wibox_layout_grid_add_EXAMPLE@ --@DOC_wibox_layout_grid_add_EXAMPLE@
-- --
-- @method add_widget_at -- @deprecatedmethod add_widget_at
-- @tparam wibox.widget child Widget that should be added -- @tparam wibox.widget child Widget that should be added
-- @tparam number row Row number for the top left corner of the widget -- @tparam number row Row number for the top left corner of the widget
-- @tparam number col Column number for the top left corner of the widget -- @tparam number col Column number for the top left corner of the widget
@ -810,30 +870,98 @@ function grid:set_min_rows_size(val)
end end
end end
-- Force the number of columns of the layout.
function grid:set_forced_num_cols(val) function grid:set_forced_num_cols(val)
gdebug.deprecate(
"The `.column_count = "..tostring(val).."`.",
{deprecated_in=5}
)
self:set_column_count(val)
end
function grid:set_forced_num_rows(val)
gdebug.deprecate(
"The `row_count = "..tostring(val).."`.",
{deprecated_in=5}
)
self:set_row_count(val)
end
-- Force the number of columns of the layout.
function grid:set_column_count(val)
if self._private.forced_num_cols ~= val then if self._private.forced_num_cols ~= val then
self._private.forced_num_cols = val self._private.forced_num_cols = val
update_dimension(self) update_dimension(self)
self:emit_signal("property::column_count", val)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
end end
-- Force the number of rows of the layout. -- Force the number of rows of the layout.
function grid:set_forced_num_rows(val) function grid:set_row_count(val)
if self._private.forced_num_rows ~= val then if self._private.forced_num_rows ~= val then
self._private.forced_num_rows = val self._private.forced_num_rows = val
update_dimension(self) update_dimension(self)
self:emit_signal("property::row_count", val)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
end end
function grid:get_row_count() function grid:get_row_count()
return self._private.num_rows return self._private.forced_num_rows or self._private.num_rows
end end
function grid:get_column_count() function grid:get_column_count()
return self._private.num_cols return self._private.forced_num_cols or self._private.num_cols
end
function grid:set_minimum_column_width(val)
if self._private.min_cols_size ~= val then
self._private.min_cols_size = val
update_dimension(self)
self:emit_signal("property::minimum_column_width", val)
self:emit_signal("widget::layout_changed")
end
end
function grid:set_minimum_row_height(val)
if self._private.min_rows_size ~= val then
self._private.min_rows_size = val
update_dimension(self)
self:emit_signal("property::minimum_column_width", val)
self:emit_signal("widget::layout_changed")
end
end
function grid:set_min_cols_size(val)
gdebug.deprecate(
"The `.minimum_column_width = "..tostring(val).."`.",
{deprecated_in=5}
)
self:set_minimum_column_width(val)
end
function grid:set_min_rows_size(val)
gdebug.deprecate(
"The `.minimum_column_width = "..tostring(val).."`.",
{deprecated_in=5}
)
self:set_minimum_row_height(val)
end
function grid:get_minimum_column_width()
return self._private.min_cols_size
end
function grid:get_minimum_row_height()
return self._private.min_rows_size
end
function grid:get_min_cols_size()
return self._private.min_cols_size
end
function grid:get_min_rows_size()
return self._private.min_rows_size
end end
function grid:set_border_width(val) function grid:set_border_width(val)
@ -906,6 +1034,7 @@ for _, prop in ipairs(properties) do
grid["set_"..prop] = function(self, value) grid["set_"..prop] = function(self, value)
if self._private[prop] ~= value then if self._private[prop] ~= value then
self._private[prop] = value self._private[prop] = value
self:emit_signal("property::"..prop, value)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
end end
@ -927,26 +1056,46 @@ for _, prop in ipairs(dir_properties) do
for _,dir in ipairs{"horizontal", "vertical"} do for _,dir in ipairs{"horizontal", "vertical"} do
local dir_prop = dir .. "_" .. prop local dir_prop = dir .. "_" .. prop
grid["set_"..dir_prop] = function(self, value) grid["set_"..dir_prop] = function(self, value)
gdebug.deprecate(
"The `".. dir_prop .."` property is deprecated. Use `".. prop .."`",
{deprecated_in=5}
)
if self._private[dir_prop] ~= value then if self._private[dir_prop] ~= value then
self._private[dir_prop] = value self._private[dir_prop] = value
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
end end
grid["get_"..dir_prop] = function(self) grid["get_"..dir_prop] = function(self)
gdebug.deprecate(
"The `".. dir_prop .."` property is deprecated. Use `".. prop .."`",
{deprecated_in=5}
)
return self._private[dir_prop] return self._private[dir_prop]
end end
end end
-- Non-directional options
grid["set_"..prop] = function(self, value) grid["set_"..prop] = function(self, value)
if self._private["horizontal_"..prop] ~= value or self._private["vertical_"..prop] ~= value then if type(value) ~= "table" then
self._private["horizontal_"..prop] = value if self._private["horizontal_"..prop] ~= value
self._private["vertical_"..prop] = value or self._private["vertical_"..prop] ~= value then
self._private["horizontal_"..prop] = value
self._private["vertical_"..prop] = value
self:emit_signal("property::"..prop, value)
self:emit_signal("widget::layout_changed")
end
else
self._private["horizontal_"..prop] = value.horizontal
self._private["vertical_"..prop] = value.vertical
self:emit_signal("property::"..prop, value)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
end end
grid["get_"..prop] = function(self) grid["get_"..prop] = function(self)
return self._private[self._private.orientation .. "_" .. prop] return {
vertical = self._private["vertical_" .. prop],
horizontal = self._private["horizontal_" .. prop],
}
end end
end end

View File

@ -27,7 +27,7 @@ local tasklist_buttons = nil --DOC_HIDE
}, },
layout = { layout = {
spacing = 5, spacing = 5,
forced_num_rows = 2, row_count = 2,
layout = wibox.layout.grid.horizontal layout = wibox.layout.grid.horizontal
}, },

View File

@ -107,9 +107,9 @@ awful.popup {
filter = awful.widget.layoutlist.source.for_screen, filter = awful.widget.layoutlist.source.for_screen,
screen = 1, screen = 1,
base_layout = wibox.widget { base_layout = wibox.widget {
spacing = 5, spacing = 5,
forced_num_cols = 5, column_count = 5,
layout = wibox.layout.grid.vertical, layout = wibox.layout.grid.vertical,
}, },
widget_template = { widget_template = {
{ {

View File

@ -98,9 +98,9 @@ gen_client("C2")
align = "center" align = "center"
}, },
layout = { layout = {
spacing = 5, spacing = 5,
forced_num_rows = 1, row_count = 1,
layout = wibox.layout.grid.horizontal layout = wibox.layout.grid.horizontal
}, },
widget_template = { widget_template = {
{ {

View File

@ -24,9 +24,9 @@ local beautiful = require("beautiful") --DOC_HIDE
source = awful.widget.layoutlist.source.default_layouts, source = awful.widget.layoutlist.source.default_layouts,
screen = 1, screen = 1,
base_layout = wibox.widget { base_layout = wibox.widget {
spacing = 5, spacing = 5,
forced_num_cols = 3, column_count = 3,
layout = wibox.layout.grid.vertical, layout = wibox.layout.grid.vertical,
}, },
widget_template = { widget_template = {
{ {

View File

@ -12,9 +12,9 @@ local modkey = "mod4" --DOC_HIDE
local ll = awful.widget.layoutlist { local ll = awful.widget.layoutlist {
source = awful.widget.layoutlist.source.default_layouts, --DOC_HIDE source = awful.widget.layoutlist.source.default_layouts, --DOC_HIDE
base_layout = wibox.widget { base_layout = wibox.widget {
spacing = 5, spacing = 5,
forced_num_cols = 5, column_count = 5,
layout = wibox.layout.grid.vertical, layout = wibox.layout.grid.vertical,
}, },
widget_template = { widget_template = {
{ {

View File

@ -42,11 +42,11 @@ local s = screen[1]
--DOC_NEWLINE --DOC_NEWLINE
if count > 5 and not self.is_grid then if count > 5 and not self.is_grid then
self.base_layout = wibox.widget { self.base_layout = wibox.widget {
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
expand = true, expand = true,
spacing = 2, spacing = 2,
layout = wibox.layout.grid.horizontal layout = wibox.layout.grid.horizontal
} }
--DOC_NEWLINE --DOC_NEWLINE
self.is_grid = true self.is_grid = true

View File

@ -8,10 +8,10 @@ wibox.widget {
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
expand = true, expand = true,
layout = wibox.layout.grid layout = wibox.layout.grid
} }
, nil, 60 --DOC_HIDE , nil, 60 --DOC_HIDE

View File

@ -6,9 +6,9 @@ local beautiful = require("beautiful") --DOC_HIDE
print("l:add_widget_at(new, 1, 4, 1, 1)") --DOC_HIDE print("l:add_widget_at(new, 1, 4, 1, 1)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, { local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, column_count = 3,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
}, 6, "add_widget_at", {--DOC_HIDE }, 6, "add_widget_at", {--DOC_HIDE
generic_widget("__new__",beautiful.bg_highlight) --DOC_HIDE generic_widget("__new__",beautiful.bg_highlight) --DOC_HIDE
, 1, 4, 1, 1 --DOC_HIDE , 1, 4, 1, 1 --DOC_HIDE

View File

@ -65,13 +65,13 @@ end
widget = generic_widget widget = generic_widget
}, },
--DOC_HIDE_END --DOC_HIDE_END
homogeneous = true, homogeneous = true,
spacing = 0, spacing = 0,
border_width = 4, border_width = 4,
border_color = beautiful.border_color, border_color = beautiful.border_color,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
--DOC_NEWLINE --DOC_NEWLINE

View File

@ -65,13 +65,13 @@ end
widget = generic_widget widget = generic_widget
}, },
--DOC_HIDE_END --DOC_HIDE_END
homogeneous = true, homogeneous = true,
spacing = 0, spacing = 0,
border_width = 4, border_width = 4,
border_color = beautiful.border_color, border_color = beautiful.border_color,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
--DOC_NEWLINE --DOC_NEWLINE

View File

@ -33,11 +33,11 @@ end
generic_widget( "fourth" ), generic_widget( "fourth" ),
generic_widget( "fifth" ), generic_widget( "fifth" ),
generic_widget( "sixth" ), generic_widget( "sixth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = homogeneous, homogeneous = homogeneous,
spacing = 10, spacing = 10,
border_width = { border_width = {
inner = width, inner = width,
outer = 1.5 * width, outer = 1.5 * width,
}, },

View File

@ -65,13 +65,13 @@ end
widget = generic_widget widget = generic_widget
}, },
--DOC_HIDE_END --DOC_HIDE_END
homogeneous = true, homogeneous = true,
spacing = 0, spacing = 0,
border_width = 4, border_width = 4,
border_color = beautiful.border_color, border_color = beautiful.border_color,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
--DOC_NEWLINE --DOC_NEWLINE

View File

@ -18,13 +18,13 @@ end
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
spacing = width, spacing = width,
border_width = 1, border_width = 1,
border_color = "red", border_color = "red",
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
--DOC_HIDE_START --DOC_HIDE_START

View File

@ -19,15 +19,15 @@ end
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
spacing = 10, spacing = 10,
border_width = { border_width = {
inner = width, inner = width,
outer = 10 - width, outer = 10 - width,
}, },
border_color = { border_color = {
inner = gears.color { inner = gears.color {
type = "linear", type = "linear",
from = { 0 , 0 }, from = { 0 , 0 },
@ -47,7 +47,7 @@ end
} }
}, },
}, },
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
--DOC_HIDE_START --DOC_HIDE_START

View File

@ -52,13 +52,13 @@ local beautiful = require("beautiful")
col_span = 2, col_span = 2,
widget = generic_widget widget = generic_widget
}, },
homogeneous = true, homogeneous = true,
spacing = 5, spacing = 5,
border_width = 1, border_width = 1,
border_color = beautiful.border_color, border_color = beautiful.border_color,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
return l, l:fit({dpi=96}, 400, 200) --DOC_HIDE return l, l:fit({dpi=96}, 400, 200) --DOC_HIDE

View File

@ -8,11 +8,11 @@ local wibox = require("wibox") --DOC_HIDE
generic_widget("third"), generic_widget("third"),
generic_widget("fourth"), generic_widget("fourth"),
generic_widget("fifth"), generic_widget("fifth"),
forced_num_cols = 2, column_count = 2,
spacing = 5, spacing = 5,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
return l, l:fit({dpi=96}, 300, 200) --DOC_HIDE return l, l:fit({dpi=96}, 300, 200) --DOC_HIDE

View File

@ -16,15 +16,15 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ), generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ), generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ), generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
expand = false, expand = false,
homogeneous = false, homogeneous = false,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },
@ -39,15 +39,15 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ), generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ), generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ), generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
expand = true, expand = true,
homogeneous = false, homogeneous = false,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },
@ -65,11 +65,11 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ), generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ), generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ), generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
expand = false, expand = false,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
@ -88,11 +88,11 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ), generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ), generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ), generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
expand = true, expand = true,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,

View File

@ -5,8 +5,8 @@ local wibox = require("wibox") --DOC_HIDE
print("l:extend_column(2)") --DOC_HIDE print("l:extend_column(2)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, { local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, column_count = 3,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
}, 6, "extend_column", {2}) --DOC_HIDE }, 6, "extend_column", {2}) --DOC_HIDE
return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -11,11 +11,11 @@ local lorem = generic_widget("Lorem ipsum dolor sit amet, consectetur " .. --
"adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") --DOC_HIDE "adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") --DOC_HIDE
local l = wibox.widget { local l = wibox.widget {
homogeneous = true, homogeneous = true,
spacing = 5, spacing = 5,
min_cols_size = 10, minimum_column_width = 10,
min_rows_size = 10, minimum_row_height = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
l:add_widget_at(first , 2, 1, 1, 2) l:add_widget_at(first , 2, 1, 1, 2)
l:add_widget_at(second, 3, 1, 1, 2) l:add_widget_at(second, 3, 1, 1, 2)

View File

@ -5,9 +5,9 @@ local wibox = require("wibox") --DOC_HIDE
print("l:insert_column(2)") --DOC_HIDE print("l:insert_column(2)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, { local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, column_count = 3,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
} }
, 6, "insert_column", {2}) --DOC_HIDE , 6, "insert_column", {2}) --DOC_HIDE
return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -6,41 +6,41 @@ local beautiful = require("beautiful") --DOC_HIDE
local w = wibox.widget { local w = wibox.widget {
{ {
{ {
markup = "<b>min_cols_size</b> = <i>0</i>", markup = "<b>minimum_column_width</b> = <i>0</i>",
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },
{ {
{ {
generic_widget( "first" ), generic_widget( "first" ),
generic_widget( "second" ), generic_widget( "second" ),
forced_num_cols = 2, column_count = 2,
min_cols_size = 0, minimum_column_width = 0,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },
{ {
{ {
markup = "<b>min_cols_size</b> = <i>100</i>", markup = "<b>minimum_column_width</b> = <i>100</i>",
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },
{ {
{ {
generic_widget( "first" ), generic_widget( "first" ),
generic_widget( "second" ), generic_widget( "second" ),
forced_num_cols = 2, column_count = 2,
min_cols_size = 100, minimum_column_width = 100,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },

View File

@ -4,10 +4,10 @@ local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE local beautiful = require("beautiful") --DOC_HIDE
print([[l = wibox.layout { print([[l = wibox.layout {
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid layout = wibox.layout.grid
} }
l:set_orientation("vertical") -- change to "horizontal" l:set_orientation("vertical") -- change to "horizontal"
l:add(...)]]) --DOC_HIDE l:add(...)]]) --DOC_HIDE
@ -27,16 +27,16 @@ wibox.widget {
generic_widget( "fourth" ), generic_widget( "fourth" ),
generic_widget( "fifth" ), generic_widget( "fifth" ),
generic_widget( "sixth" ), generic_widget( "sixth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
orientation = "vertical", orientation = "vertical",
expand = false, expand = false,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },
@ -53,16 +53,16 @@ wibox.widget {
generic_widget( "fourth" ), generic_widget( "fourth" ),
generic_widget( "fifth" ), generic_widget( "fifth" ),
generic_widget( "sixth" ), generic_widget( "sixth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
orientation = 'horizontal', orientation = 'horizontal',
expand = false, expand = false,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },

View File

@ -1,8 +1,8 @@
l = wibox.layout { l = wibox.layout {
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid layout = wibox.layout.grid
} }
l:set_orientation("vertical") -- change to "horizontal" l:set_orientation("vertical") -- change to "horizontal"
l:add(...) l:add(...)

View File

@ -5,9 +5,9 @@ local wibox = require("wibox") --DOC_HIDE
print("l:remove_widgets_at(1,1)") --DOC_HIDE print("l:remove_widgets_at(1,1)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, { local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, column_count = 3,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
}, 6, "remove_widgets_at", {1, 1}) --DOC_HIDE }, 6, "remove_widgets_at", {1, 1}) --DOC_HIDE
return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -5,9 +5,9 @@ local wibox = require("wibox") --DOC_HIDE
print("l:remove_column(2)") --DOC_HIDE print("l:remove_column(2)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, { local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3, column_count = 3,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
}, 6, "remove_column", {2} --DOC_HIDE }, 6, "remove_column", {2} --DOC_HIDE
) )
return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE return w, w:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -19,15 +19,15 @@ local w = wibox.widget {
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
spacing = 0, spacing = 0,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },
@ -42,15 +42,15 @@ local w = wibox.widget {
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
homogeneous = true, homogeneous = true,
spacing = 10, spacing = 10,
layout = wibox.layout.grid, layout = wibox.layout.grid,
}, },
margins = 1, margins = 1,
color = beautiful.border_color, color = beautiful.border_color,
layout = wibox.container.margin, layout = wibox.container.margin,
}, },
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
}, },

View File

@ -8,11 +8,11 @@ local w = wibox.widget {
generic_widget( "second" ), generic_widget( "second" ),
generic_widget( "third" ), generic_widget( "third" ),
generic_widget( "fourth" ), generic_widget( "fourth" ),
forced_num_cols = 2, column_count = 2,
forced_num_rows = 2, row_count = 2,
superpose = true, superpose = true,
homogeneous = true, homogeneous = true,
layout = wibox.layout.grid, layout = wibox.layout.grid,
} }
w:add_widget_at( w:add_widget_at(
generic_widget("fifth",beautiful.bg_highlight) generic_widget("fifth",beautiful.bg_highlight)

View File

@ -54,9 +54,9 @@ parent:add(
icons[1], icons[1],
icons[2], icons[2],
icons[3], icons[3],
forced_num_rows = 2, column_count = 2,
forced_num_cols = 3, row_count = 3,
spacing = 5, spacing = 5,
widget = wibox.layout.grid, widget = wibox.layout.grid,
} }
) )