Merge pull request #3746 from Elv13/grid_border

Modernize the `wibox.layout.grid` module and add border support.
This commit is contained in:
Emmanuel Lepage Vallée 2024-03-23 22:50:03 -07:00 committed by GitHub
commit 8b1f8958b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 1411 additions and 211 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
still supported, but will lack the ability to use some textbox properties,
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>
# Awesome window manager framework version 4.3 changes

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@ local calendar = { mt = {} }
local properties = { "date" , "font" , "spacing" , "week_numbers",
"start_sunday", "long_weekdays", "fn_embed", "flex_height",
"border_width", "border_color" ,
}
--- The calendar font.
@ -66,6 +67,12 @@ local properties = { "date" , "font" , "spacing" , "week_numbers"
-- @beautiful beautiful.flex_height
-- @param boolean Cells can skretch to fill the empty space.
--- Set the color for the empty space where there are no date widgets.
--
-- This happens when the month doesn't start on a Sunday or stop on a Saturday.
-- @beautiful beautiful.calendar_empty_color
-- @param color The empty area color.
--- The calendar date.
--
-- E.g.. `{day=21, month=2, year=2005}`, `{month=2, year=2005}, {year=2005}`
@ -147,6 +154,54 @@ local properties = { "date" , "font" , "spacing" , "week_numbers"
-- @property flex_height
-- @usebeautiful beautiful.flex_height
--- Set the calendar border width.
-- @property border_width
-- @tparam[opt=0] integer|table border_width
-- @tparam color border_width.inner The border between the cells.
-- @tparam color border_width.outer The border around the calendar.
-- @propertytype color Use the same value for inner and outer borders.
-- @propertytype table Specify a different value for the inner and outer borders.
-- @negativeallowed false
-- @see border_color
-- @see wibox.layout.grid.border_width
--- Set the calendar border color.
-- @property border_color
-- @tparam[opt=0] color|table border_color
-- @tparam color border_color.inner The border between the cells.
-- @tparam color border_color.outer The border around the calendar.
-- @propertytype color Use the same value for inner and outer borders.
-- @propertytype table Specify a different value for the inner and outer borders.
-- @see border_width
-- @see wibox.layout.grid.border_color
--- Set the color for the empty cells.
--
-- @property empty_color
-- @tparam[opt=nil] color|nil empty_color
-- @usebeautiful beautiful.calendar_empty_color
-- @see empty_widget
-- @see empty_cell_mode
--- Set a widget for the empty cells.
--
-- @property empty_widget
-- @tparam[opt=nil] widget|nil empty_widget
-- @see empty_color
-- @see empty_cell_mode
--- How should the cells outside of the current month should be handled.
--
-- @property empty_cell_mode
-- @tparam[opt="merged"] string empty_cell_mode
-- @propertyvalue "merged" Merge all cells and display the `empty_widget` or
-- `empty_color`.
-- @propertyvalue "split" Display one `empty_widget` per day rather than merge
-- them.
-- @propertyvalue "rolling" Display the dates from the previous or next month.
-- @see empty_widget
-- @see empty_color
--- Make a textbox
-- @tparam string text Text of the textbox
-- @tparam string font Font of the text
@ -210,6 +265,14 @@ local function create_month(props, date)
layout:set_forced_num_rows(num_rows)
layout:set_forced_num_cols(num_columns)
if props.border_width then
layout:set_border_width(props.border_width)
end
if props.border_color then
layout:set_border_color(props.border_color)
end
--local flags = {"header", "weekdays", "weeknumber", "normal", "focus"}
local cell_date, t, i, j, w, flag, text
@ -385,6 +448,7 @@ local function get_calendar(type, date, font)
ret._private.long_weekdays = beautiful.calendar_long_weekdays or false
ret._private.flex_height = beautiful.calendar_flex_height or false
ret._private.fn_embed = function (w, _) return w end
ret._private.empty_widget = bgcontainer(beautiful.calendar_empty_color)
-- header specific
ret._private.subtype = type=="year" and "monthheader" or "fullheader"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,10 +8,10 @@ wibox.widget {
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
forced_num_cols = 2,
forced_num_rows = 2,
homogeneous = true,
expand = true,
layout = wibox.layout.grid
column_count = 2,
row_count = 2,
homogeneous = true,
expand = true,
layout = wibox.layout.grid
}
, 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
local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3,
forced_num_rows = 2,
homogeneous = true,
column_count = 3,
row_count = 2,
homogeneous = true,
}, 6, "add_widget_at", {--DOC_HIDE
generic_widget("__new__",beautiful.bg_highlight) --DOC_HIDE
, 1, 4, 1, 1 --DOC_HIDE

View File

@ -0,0 +1,85 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local generic_widget_ = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
local w = wibox.widget {
--DOC_HIDE_START
-- [...] Some widgets here.
{
text = "none",
row_index = 1,
col_index = 1,
col_span = 3,
widget = generic_widget
},
{
text = "first",
col_span = 2,
row_index = 2,
col_index = 1,
widget = generic_widget
},
{
text = "third",
row_index = 2,
col_index = 3,
row_span = 2,
widget = generic_widget
},
{
text = "second",
row_index = 3,
col_index = 1,
col_span = 2,
widget = generic_widget
},
{
text = "fourth",
row_index = 4,
col_index = 1,
widget = generic_widget
},
{
text = "fifth",
row_index = 4,
col_index = 2,
col_span = 2,
widget = generic_widget
},
{
text = "sixth",
row_index = 1,
col_index = 4,
row_span = 4,
widget = generic_widget
},
--DOC_HIDE_END
homogeneous = true,
spacing = 0,
border_width = 4,
border_color = beautiful.border_color,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
--DOC_NEWLINE
w:add_column_border(1, 5 , { color = "purple" })
w:add_column_border(2, 10, { color = "cyan" })
w:add_column_border(3, 5 , { color = "magenta"})
w:add_column_border(4, 5 , { color = "black" })
w:add_column_border(5, 10, { color = "grey" })
l:add(w) --DOC_HIDE
return l, l:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -0,0 +1,85 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local generic_widget_ = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
local w = wibox.widget {
-- [...] Some widgets here.
--DOC_HIDE_START
{
text = "none",
row_index = 1,
col_index = 1,
col_span = 3,
widget = generic_widget
},
{
text = "first",
col_span = 2,
row_index = 2,
col_index = 1,
widget = generic_widget
},
{
text = "third",
row_index = 2,
col_index = 3,
row_span = 2,
widget = generic_widget
},
{
text = "second",
row_index = 3,
col_index = 1,
col_span = 2,
widget = generic_widget
},
{
text = "fourth",
row_index = 4,
col_index = 1,
widget = generic_widget
},
{
text = "fifth",
row_index = 4,
col_index = 2,
col_span = 2,
widget = generic_widget
},
{
text = "sixth",
row_index = 1,
col_index = 4,
row_span = 4,
widget = generic_widget
},
--DOC_HIDE_END
homogeneous = true,
spacing = 0,
border_width = 4,
border_color = beautiful.border_color,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
--DOC_NEWLINE
w:add_row_border(1, 40, { color = "red" })
w:add_row_border(2, 5 , { color = "green" , dashes = {5, 3, 10, 3}})
w:add_row_border(3, 10, { color = "blue" , dashes = {5, 3, 10, 3}, dash_offset = 5})
w:add_row_border(4, 30, { color = "orange", dashes = {5, 40}, caps = "round"})
w:add_row_border(5, 10, { color = "yellow"})
l:add(w) --DOC_HIDE
return l, l:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -0,0 +1,62 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local generic_widget_ = ...
local wibox = require("wibox")
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.vertical
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
for _, expand in ipairs { true, false } do
for _, homogeneous in ipairs { true, false } do
--DOC_HIDE_START
local row = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
l:add(wibox.widget.textbox(
"<b>`expand = "..tostring(expand).."`, `homogeneous = "..tostring(homogeneous).."`</b>:"
))
l:add(row)
--DOC_HIDE_END
for _, width in ipairs { 0, 1, 2, 4, 10 } do
local w = wibox.widget {
generic_widget( "first" ),
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
generic_widget( "fifth" ),
generic_widget( "sixth" ),
column_count = 2,
row_count = 2,
homogeneous = homogeneous,
spacing = 10,
border_width = {
inner = width,
outer = 1.5 * width,
},
border_color = "red",
expand = expand,
forced_height = expand and 200 or nil,
layout = wibox.layout.grid,
}
--DOC_HIDE_START
row:add(wibox.widget {
wibox.widget.textbox("<i> `border_width = ".. width .."`</i>: "),
w,
layout = wibox.layout.fixed.vertical
})
--DOC_HIDE_END
end
end
end
--DOC_HIDE_START
return l, l:fit({dpi=96}, 9999, 9999)

View File

@ -0,0 +1,91 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local generic_widget_ = ...
local wibox = require("wibox")
local beautiful = require("beautiful")
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
local w = wibox.widget {
--DOC_HIDE_START
-- [...] Some widgets here.
{
text = "none",
row_index = 1,
col_index = 1,
col_span = 3,
widget = generic_widget
},
{
text = "first",
col_span = 2,
row_index = 2,
col_index = 1,
widget = generic_widget
},
{
text = "third",
row_index = 2,
col_index = 3,
row_span = 2,
widget = generic_widget
},
{
text = "second",
row_index = 3,
col_index = 1,
col_span = 2,
widget = generic_widget
},
{
text = "fourth",
row_index = 4,
col_index = 1,
widget = generic_widget
},
{
text = "fifth",
row_index = 4,
col_index = 2,
col_span = 2,
widget = generic_widget
},
{
text = "sixth",
row_index = 1,
col_index = 4,
row_span = 4,
widget = generic_widget
},
--DOC_HIDE_END
homogeneous = true,
spacing = 0,
border_width = 4,
border_color = beautiful.border_color,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
--DOC_NEWLINE
w:add_row_border(1, 40, { color = "red" })
w:add_row_border(2, 5 , { color = "green" , dashes = {5, 3, 10, 3}})
w:add_row_border(3, 10, { color = "blue" , dashes = {5, 3, 10, 3}, dash_offset = 5})
w:add_row_border(4, 30, { color = "orange", dashes = {5, 40}, caps = "round"})
w:add_row_border(5, 10, { color = "yellow"})
--DOC_NEWLINE
w:add_column_border(1, 5, { color = "purple"})
w:add_column_border(2, 10, { color = "cyan"})
w:add_column_border(3, 5, { color = "magenta"})
w:add_column_border(4, 5, { color = "black"})
w:add_column_border(5, 10, { color = "grey"})
l:add(w) --DOC_HIDE
return l, l:fit({dpi=96}, 9999, 9999) --DOC_HIDE

View File

@ -0,0 +1,40 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local generic_widget_ = ...
local wibox = require("wibox") --DOC_HIDE
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
for _, width in ipairs { 0, 1, 2, 4, 10 } do
local w = wibox.widget {
generic_widget( "first" ),
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
column_count = 2,
row_count = 2,
homogeneous = true,
spacing = width,
border_width = 1,
border_color = "red",
layout = wibox.layout.grid,
}
--DOC_HIDE_START
l:add(wibox.widget {
wibox.widget.textbox("<b> `spacing = ".. width .."`</b>: "),
w,
layout = wibox.layout.fixed.vertical
})
--DOC_HIDE_END
end
--DOC_HIDE_START
return l, l:fit({dpi=96}, 9999, 9999)

View File

@ -0,0 +1,67 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local generic_widget_ = ...
local wibox = require("wibox")
local gears = { color = require("gears.color") }
local l = wibox.widget {
spacing = 10,
layout = wibox.layout.fixed.horizontal
}
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
--DOC_HIDE_END
for _, width in ipairs { 0, 1, 2, 4, 10 } do
local w = wibox.widget {
generic_widget( "first" ),
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
column_count = 2,
row_count = 2,
homogeneous = true,
spacing = 10,
border_width = {
inner = width,
outer = 10 - width,
},
border_color = {
inner = gears.color {
type = "linear",
from = { 0 , 0 },
to = { 100, 100 },
stops = {
{ 0, "#ff0000" },
{ 1, "#ffff00" },
}
},
outer = gears.color {
type = "linear",
from = { 0 , 0 },
to = { 100, 100 },
stops = {
{ 0, "#0000ff" },
{ 1, "#ff0000" },
}
},
},
layout = wibox.layout.grid,
}
--DOC_HIDE_START
l:add(wibox.widget {
wibox.widget.textbox(
"<b>"..
"`border_width.outer = ".. (10-width) .."`\n"..
"`border_width.inner = ".. width .."`"..
"</b>:"),
w,
layout = wibox.layout.fixed.vertical
})
--DOC_HIDE_STOP
end
--DOC_HIDE_START
return l, l:fit({dpi=96}, 9999, 9999)

View File

@ -0,0 +1,64 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local generic_widget = ... --DOC_NO_USAGE
local wibox = require("wibox")
local beautiful = require("beautiful")
--DOC_HIDE_END
local lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing " ..
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
--DOC_NEWLINE
local l = wibox.widget {
{
text = lorem,
row_index = 1,
col_index = 1,
col_span = 3,
widget = generic_widget
},
{
text = "first",
col_span = 2,
row_index = 2,
col_index = 1,
widget = generic_widget
},
{
text = "third",
row_index = 2,
col_index = 3,
row_span = 2,
widget = generic_widget
},
{
text = "second",
row_index = 3,
col_index = 1,
col_span = 2,
widget = generic_widget
},
{
text = "fourth",
row_index = 4,
col_index = 1,
widget = generic_widget
},
{
text = "fifth",
row_index = 4,
col_index = 2,
col_span = 2,
widget = generic_widget
},
homogeneous = true,
spacing = 5,
border_width = 1,
border_color = beautiful.border_color,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
return l, l:fit({dpi=96}, 400, 200) --DOC_HIDE

View File

@ -0,0 +1,18 @@
--DOC_GEN_IMAGE --DOC_HIDE
local generic_widget = ... --DOC_NO_USAGE --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local l = wibox.widget {
generic_widget("first"),
generic_widget("second"),
generic_widget("third"),
generic_widget("fourth"),
generic_widget("fifth"),
column_count = 2,
spacing = 5,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
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( "short 2" ),
generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2,
forced_num_rows = 2,
expand = false,
homogeneous = false,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
expand = false,
homogeneous = false,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},
@ -39,15 +39,15 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2,
forced_num_rows = 2,
expand = true,
homogeneous = false,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
expand = true,
homogeneous = false,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},
@ -65,11 +65,11 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2,
forced_num_rows = 2,
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
@ -88,11 +88,11 @@ local w = wibox.widget {
generic_widget( "-------- long 1 --------" ),
generic_widget( "short 2" ),
generic_widget( "-------- long 2 --------" ),
forced_num_cols = 2,
forced_num_rows = 2,
expand = true,
homogeneous = true,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
expand = true,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,

View File

@ -5,8 +5,8 @@ local wibox = require("wibox") --DOC_HIDE
print("l:extend_column(2)") --DOC_HIDE
local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3,
forced_num_rows = 2,
homogeneous = true,
column_count = 3,
row_count = 2,
homogeneous = true,
}, 6, "extend_column", {2}) --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
local l = wibox.widget {
homogeneous = true,
spacing = 5,
min_cols_size = 10,
min_rows_size = 10,
layout = wibox.layout.grid,
homogeneous = true,
spacing = 5,
minimum_column_width = 10,
minimum_row_height = 10,
layout = wibox.layout.grid,
}
l:add_widget_at(first , 2, 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
local w = generic_before_after(wibox.layout.grid, {
forced_num_cols = 3,
forced_num_rows = 2,
homogeneous = true,
column_count = 3,
row_count = 2,
homogeneous = true,
}
, 6, "insert_column", {2}) --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 {
{
{
markup = "<b>min_cols_size</b> = <i>0</i>",
markup = "<b>minimum_column_width</b> = <i>0</i>",
widget = wibox.widget.textbox
},
{
{
generic_widget( "first" ),
generic_widget( "second" ),
forced_num_cols = 2,
min_cols_size = 0,
homogeneous = true,
layout = wibox.layout.grid,
column_count = 2,
minimum_column_width = 0,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
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
},
{
{
generic_widget( "first" ),
generic_widget( "second" ),
forced_num_cols = 2,
min_cols_size = 100,
homogeneous = true,
layout = wibox.layout.grid,
column_count = 2,
minimum_column_width = 100,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},

View File

@ -1,42 +1,33 @@
--DOC_GEN_OUTPUT --DOC_GEN_IMAGE
local generic_widget = ... --DOC_HIDE_ALL
local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
--DOC_GEN_IMAGE
local generic_widget = ... --DOC_HIDE_START
local wibox = require("wibox")
local beautiful = require("beautiful")
print([[l = wibox.layout {
forced_num_cols = 2,
forced_num_rows = 2,
homogeneous = true,
layout = wibox.layout.grid
}
l:set_orientation("vertical") -- change to "horizontal"
l:add(...)]]) --DOC_HIDE
return --DOC_HIDE
return
wibox.widget {
{
{
markup = "<b>orientation</b> = <i>'vertical'</i>",
widget = wibox.widget.textbox
},
{
{
{ --DOC_HIDE_STOP
{--DOC_HIDE_START
generic_widget( "first" ),
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
generic_widget( "fifth" ),
generic_widget( "sixth" ),
forced_num_cols = 2,
forced_num_rows = 2,
orientation = "vertical",
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
generic_widget( "sixth" ),--DOC_HIDE_STOP
column_count = 2,
row_count = 2,
orientation = "vertical",
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
margins = 1,--DOC_HIDE_START
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},
@ -53,19 +44,20 @@ wibox.widget {
generic_widget( "fourth" ),
generic_widget( "fifth" ),
generic_widget( "sixth" ),
forced_num_cols = 2,
forced_num_rows = 2,
orientation = 'horizontal',
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
orientation = 'horizontal',
expand = false,
homogeneous = true,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},
spacing = 5,
layout = wibox.layout.fixed.horizontal
}
, 300, 90 --DOC_HIDE
, 300, 90

View File

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

View File

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

View File

@ -1,8 +1,12 @@
--DOC_GEN_IMAGE
local generic_widget = ... --DOC_HIDE_ALL
local generic_widget_ = ... --DOC_HIDE_ALL
local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
local function generic_widget(txt)
return generic_widget_(txt, nil, 0)
end
local w = wibox.widget {
{
{
@ -15,16 +19,15 @@ local w = wibox.widget {
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
forced_num_cols = 2,
forced_num_rows = 2,
homogeneous = true,
spacing = 0,
padding = 0,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
homogeneous = true,
spacing = 0,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},
@ -39,16 +42,15 @@ local w = wibox.widget {
generic_widget( "second" ),
generic_widget( "third" ),
generic_widget( "fourth" ),
forced_num_cols = 2,
forced_num_rows = 2,
homogeneous = true,
spacing = 10,
padding = 0,
layout = wibox.layout.grid,
column_count = 2,
row_count = 2,
homogeneous = true,
spacing = 10,
layout = wibox.layout.grid,
},
margins = 1,
color = beautiful.border_color,
layout = wibox.container.margin,
color = beautiful.border_color,
layout = wibox.container.margin,
},
layout = wibox.layout.fixed.vertical
},

View File

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

View File

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

View File

@ -14,5 +14,6 @@ beautiful.fg_focus = "#ff9800" --DOC_HIDE
beautiful.bg_focus = "#b9214f" --DOC_HIDE
local cal = wibox.widget.calendar.month(os.date("*t"))
cal.border_width = 1
parent:add(cal) --DOC_HIDE