diff --git a/tests/examples/wibox/layout/fixed/spacing.lua b/tests/examples/wibox/layout/fixed/spacing.lua new file mode 100644 index 000000000..a5e4abc11 --- /dev/null +++ b/tests/examples/wibox/layout/fixed/spacing.lua @@ -0,0 +1,28 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE + +local first, second, third = generic_widget("first"), --DOC_HIDE + generic_widget("second"), generic_widget("third") --DOC_HIDE + +local ret = wibox.layout.fixed.vertical() --DOC_HIDE + +for i=1, 5 do + ret:add(wibox.widget { --DOC_HIDE + markup = "Iteration " .. i ..":", --DOC_HIDE + widget = wibox.widget.textbox --DOC_HIDE + }) --DOC_HIDE + + local w = wibox.widget { + first, + second, + third, + spacing = i*3, + layout = wibox.layout.fixed.horizontal + } + + ret:add(w) --DOC_HIDE +end + +return ret, 200, 200 --DOC_HIDE + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/layout/fixed/spacing_widget.lua b/tests/examples/wibox/layout/fixed/spacing_widget.lua new file mode 100644 index 000000000..d1531e0f7 --- /dev/null +++ b/tests/examples/wibox/layout/fixed/spacing_widget.lua @@ -0,0 +1,70 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape")}--DOC_HIDE + +local l = wibox.layout.flex.vertical() --DOC_HIDE + +-- Use the separator widget directly +local w1 = wibox.widget { + generic_widget( "first" , nil, 0), --DOC_HIDE + generic_widget( "second" , nil, 0), --DOC_HIDE + generic_widget( "third" , nil, 0), --DOC_HIDE + spacing = 10, + spacing_widget = wibox.widget.separator, + layout = wibox.layout.fixed.horizontal +} + +l:add(w1) --DOC_HIDE + +-- Use a standard declarative widget construct +local w2 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + color = "#00ff00", + shape = gears.shape.circle, + widget = wibox.widget.separator, + }, + layout = wibox.layout.fixed.horizontal +} + +l:add(w2) --DOC_HIDE + +-- Use composed widgets +local w3 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + { + text = "F", + widget = wibox.widget.textbox, + }, + bg = "#ff0000", + widget = wibox.container.background, + }, + layout = wibox.layout.fixed.horizontal +} + +l:add(w3) --DOC_HIDE + +-- Use negative spacing to create a powerline effect +local w4 = wibox.widget { + generic_widget( " first " , nil, 0), --DOC_HIDE + generic_widget( " second " , nil, 0), --DOC_HIDE + generic_widget( " third " , nil, 0), --DOC_HIDE + spacing = -12, + spacing_widget = { + color = "#ff0000", + shape = gears.shape.powerline, + widget = wibox.widget.separator, + }, + layout = wibox.layout.fixed.horizontal +} + +l:add(w4) --DOC_HIDE + +return l, 250, 4*30 --DOC_HIDE diff --git a/tests/examples/wibox/layout/flex/spacing.lua b/tests/examples/wibox/layout/flex/spacing.lua new file mode 100644 index 000000000..f771d9144 --- /dev/null +++ b/tests/examples/wibox/layout/flex/spacing.lua @@ -0,0 +1,28 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE + +local first, second, third = generic_widget("first"), --DOC_HIDE + generic_widget("second"), generic_widget("third") --DOC_HIDE + +local ret = wibox.layout.fixed.vertical() --DOC_HIDE + +for i=1, 5 do + ret:add(wibox.widget { --DOC_HIDE + markup = "Iteration " .. i ..":", --DOC_HIDE + widget = wibox.widget.textbox --DOC_HIDE + }) --DOC_HIDE + + local w = wibox.widget { + first, + second, + third, + spacing = i*5, + layout = wibox.layout.flex.horizontal + } + + ret:add(w) --DOC_HIDE +end + +return ret, 200, 200 --DOC_HIDE + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/layout/flex/spacing_widget.lua b/tests/examples/wibox/layout/flex/spacing_widget.lua new file mode 100644 index 000000000..e9586e021 --- /dev/null +++ b/tests/examples/wibox/layout/flex/spacing_widget.lua @@ -0,0 +1,70 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape")}--DOC_HIDE + +local l = wibox.layout.flex.vertical() --DOC_HIDE + +-- Use the separator widget directly +local w1 = wibox.widget { + generic_widget( "first" , nil, 0), --DOC_HIDE + generic_widget( "second" , nil, 0), --DOC_HIDE + generic_widget( "third" , nil, 0), --DOC_HIDE + spacing = 10, + spacing_widget = wibox.widget.separator, + layout = wibox.layout.flex.horizontal +} + +l:add(w1) --DOC_HIDE + +-- Use a standard declarative widget construct +local w2 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + color = "#00ff00", + shape = gears.shape.circle, + widget = wibox.widget.separator, + }, + layout = wibox.layout.flex.horizontal +} + +l:add(w2) --DOC_HIDE + +-- Use composed widgets +local w3 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + { + text = "F", + widget = wibox.widget.textbox, + }, + bg = "#ff0000", + widget = wibox.container.background, + }, + layout = wibox.layout.flex.horizontal +} + +l:add(w3) --DOC_HIDE + +-- Use negative spacing to create a powerline effect +local w4 = wibox.widget { + generic_widget( " first " , nil, 0), --DOC_HIDE + generic_widget( " second " , nil, 0), --DOC_HIDE + generic_widget( " third " , nil, 0), --DOC_HIDE + spacing = -12, + spacing_widget = { + color = "#ff0000", + shape = gears.shape.powerline, + widget = wibox.widget.separator, + }, + layout = wibox.layout.flex.horizontal +} + +l:add(w4) --DOC_HIDE + +return l, 250, 4*30 --DOC_HIDE diff --git a/tests/examples/wibox/layout/ratio/spacing.lua b/tests/examples/wibox/layout/ratio/spacing.lua new file mode 100644 index 000000000..6c1304d84 --- /dev/null +++ b/tests/examples/wibox/layout/ratio/spacing.lua @@ -0,0 +1,29 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE + +local first, second, third = generic_widget("first"), --DOC_HIDE + generic_widget("second"), generic_widget("third") --DOC_HIDE + +local ret = wibox.layout.fixed.vertical() --DOC_HIDE + +for i=1, 5 do + ret:add(wibox.widget { --DOC_HIDE + markup = "Iteration " .. i ..":", --DOC_HIDE + widget = wibox.widget.textbox --DOC_HIDE + }) --DOC_HIDE + + local w = wibox.widget { + first, + second, + third, + spacing = i*3, + force_width = 200, --DOC_HIDE + layout = wibox.layout.ratio.horizontal + } + + ret:add(w) --DOC_HIDE +end + +return ret, 200, 200 --DOC_HIDE + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/layout/ratio/spacing_widget.lua b/tests/examples/wibox/layout/ratio/spacing_widget.lua new file mode 100644 index 000000000..1fea3bd97 --- /dev/null +++ b/tests/examples/wibox/layout/ratio/spacing_widget.lua @@ -0,0 +1,70 @@ +local generic_widget = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape")}--DOC_HIDE + +local l = wibox.layout.flex.vertical() --DOC_HIDE + +-- Use the separator widget directly +local w1 = wibox.widget { + generic_widget( "first" , nil, 0), --DOC_HIDE + generic_widget( "second" , nil, 0), --DOC_HIDE + generic_widget( "third" , nil, 0), --DOC_HIDE + spacing = 10, + spacing_widget = wibox.widget.separator, + layout = wibox.layout.ratio.horizontal +} + +l:add(w1) --DOC_HIDE + +-- Use a standard declarative widget construct +local w2 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + color = "#00ff00", + shape = gears.shape.circle, + widget = wibox.widget.separator, + }, + layout = wibox.layout.ratio.horizontal +} + +l:add(w2) --DOC_HIDE + +-- Use composed widgets +local w3 = wibox.widget { + generic_widget( "first" ), --DOC_HIDE + generic_widget( "second" ), --DOC_HIDE + generic_widget( "third" ), --DOC_HIDE + spacing = 10, + spacing_widget = { + { + text = "F", + widget = wibox.widget.textbox, + }, + bg = "#ff0000", + widget = wibox.container.background, + }, + layout = wibox.layout.ratio.horizontal +} + +l:add(w3) --DOC_HIDE + +-- Use negative spacing to create a powerline effect +local w4 = wibox.widget { + generic_widget( " first " , nil, 0), --DOC_HIDE + generic_widget( " second " , nil, 0), --DOC_HIDE + generic_widget( " third " , nil, 0), --DOC_HIDE + spacing = -12, + spacing_widget = { + color = "#ff0000", + shape = gears.shape.powerline, + widget = wibox.widget.separator, + }, + layout = wibox.layout.ratio.horizontal +} + +l:add(w4) --DOC_HIDE + +return l, 250, 4*30 --DOC_HIDE