doc: Improve the progressbar doc.

Another commit in the "lets finish the widget doc" serie.
This commit is contained in:
Emmanuel Lepage Vallee 2021-11-02 19:29:31 -07:00
parent 50b9b10437
commit 0afb719f82
20 changed files with 985 additions and 12 deletions

323
docs/images/progressbar.svg Normal file
View File

@ -0,0 +1,323 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="487.79703pt"
height="235.03819pt"
viewBox="0 0 487.79703 235.03818"
version="1.1"
id="svg5373"
sodipodi:docname="progressbar.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<metadata
id="metadata5379">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs5377" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1358"
inkscape:window-height="915"
id="namedview5375"
showgrid="false"
inkscape:zoom="0.86691177"
inkscape:cx="288.7394"
inkscape:cy="73.932507"
inkscape:window-x="19"
inkscape:window-y="13"
inkscape:window-maximized="0"
inkscape:current-layer="surface2"
fit-margin-top="0.6"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<g
id="surface2"
transform="translate(206.37505,94.328624)">
<g
id="g5385"
transform="matrix(1.9097732,0,0,1.9097732,-34.137846,-21.370993)">
<path
inkscape:connector-curvature="0"
id="path5368"
transform="translate(1,1)"
d="M 0,0 H 83 V 28 H 0 Z m 0,0"
style="fill:#617fff;fill-opacity:0.49019602;fill-rule:nonzero;stroke:#00ff00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1" />
</g>
<g
id="g5382"
transform="matrix(1.9097732,0,0,1.9097732,-37.058587,-23.280767)">
<path
inkscape:connector-curvature="0"
id="path5370"
transform="translate(8,7)"
d="M 0,0 H 66 V 18 H 0 Z m 0,0"
style="fill:#a800ff;fill-opacity:0.49019602;fill-rule:nonzero;stroke:#ffff00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1" />
</g>
<rect
style="fill:none;stroke:#000000;stroke-width:5.72931957;stroke-miterlimit:4;stroke-dasharray:17.18795897, 5.72931965;stroke-dashoffset:0;stroke-opacity:0.19282514"
id="rect6202"
width="223.72885"
height="103.9784"
x="-65.681862"
y="-44.285286" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -65.681858,-44.285287 v -9.346375 h 33.880606 v 7.593928"
id="path6204"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -68.602599,-44.285289 h -8.908263 v 22.781787 h 8.762225"
id="path6206"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -68.456562,36.181149 h -8.178079 v 20.883305 h 8.032042"
id="path6208"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 129.4237,62.613864 v 7.593929 h 27.16289 v -7.886004"
id="path6210"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -23.039026,31.946074 v 7.009781 h -7.886004 v -7.009781"
id="path6212"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 106.64191,32.530222 v 6.717706 h 16.9403 v -7.593927"
id="path6214"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 124.45843,-16.830315 h 7.0098 v 6.425632 h -7.30186 v 0"
id="path6216"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 99.632131,-12.157128 v -3.796965 h 6.717709 v 4.381114"
id="path6218"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -34.721994,-21.211428 h -4.089039 v 3.50489 h 4.381113"
id="path6220"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 132.05237,-13.325425 h 34.17266"
id="path6222"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 102.58345,-16.2321 V -52.580964"
id="path6224"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 115.18163,39.530362 v 40.06636"
id="path6226"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 144.0955,70.509507 V 86.825191"
id="path6228"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -26.702851,38.91078 v 27.261648 0"
id="path6232"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -76.062956,45.313136 h -8.261102"
id="path6234"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -78.541288,-33.580422 h -7.641524"
id="path6236"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -47.975197,-54.646241 v -6.815411"
id="path6238"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M -39.404301,-19.226751 H -86.905655"
id="path6240"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 40.212104,-63.526928 V 7.1055221"
id="path6242"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 44.755712,28.584397 V 107.89101"
id="path6244"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-81.409393"
y="-68.525108"
id="text6248"><tspan
sodipodi:role="line"
id="tspan6246"
x="-81.409393"
y="-68.525108"
style="stroke-width:1.43232989">margins.left</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="53.016815"
y="88.064354"
id="text6252"><tspan
sodipodi:role="line"
id="tspan6250"
x="53.016815"
y="88.064354"
style="stroke-width:1.43232989">paddings.right</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-173.14709"
y="47.484715"
id="text6256"><tspan
sodipodi:role="line"
id="tspan6254"
x="-173.14709"
y="47.484715"
style="stroke-width:1.43232989">margins.bottom</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-68.008377"
y="80.629356"
id="text6260"><tspan
sodipodi:role="line"
x="-68.008377"
y="80.629356"
style="stroke-width:1.43232989"
id="tspan6262">paddings.left</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="25.046478"
y="-68.112053"
id="text6268"><tspan
sodipodi:role="line"
id="tspan6266"
x="25.046478"
y="-68.112053"
style="stroke-width:1.43232989">color</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="0.55879593"
y="121.52184"
id="text6272"><tspan
sodipodi:role="line"
id="tspan6270"
x="0.55879593"
y="121.52184"
style="stroke-width:1.43232989">background_color</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1.43232989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M -33.72479,8.7577433 H -101.0528"
id="path6274"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-171.67308"
y="10.752149"
id="text6278"><tspan
sodipodi:role="line"
id="tspan6276"
x="-171.67308"
y="10.752149"
style="stroke-width:1.43232989">border_color</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="59.921341"
y="-56.416924"
id="text6282"><tspan
sodipodi:role="line"
id="tspan6280"
x="59.921341"
y="-56.416924"
style="stroke-width:1.43232989">bar_border_width</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="176.52036"
y="-13.960297"
id="text6286"><tspan
sodipodi:role="line"
id="tspan6284"
x="176.52036"
y="-13.960297"
style="stroke-width:1.43232989">paddings.top</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="114.56205"
y="103.76046"
id="text6290"><tspan
sodipodi:role="line"
id="tspan6288"
x="114.56205"
y="103.76046"
style="stroke-width:1.43232989">margins.right</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-161.98454"
y="-15.825125"
id="text6294"><tspan
sodipodi:role="line"
id="tspan6292"
x="-161.98454"
y="-15.825125"
style="stroke-width:1.43232989">border_width</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:11.45863914px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.43232989"
x="-154.04338"
y="-30.323574"
id="text6298"><tspan
sodipodi:role="line"
id="tspan6296"
x="-154.04338"
y="-30.323574"
style="stroke-width:1.43232989">margins.top</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,6 +1,11 @@
---------------------------------------------------------------------------
--- A progressbar widget.
--
-- ![Components](../images/progressbar.svg)
--
-- Common usage examples
-- =====================
--
-- To add text on top of the progressbar, a `wibox.layout.stack` can be used:
--
--@DOC_wibox_widget_progressbar_text_EXAMPLE@
@ -13,6 +18,15 @@
-- a `wibox.container.constraint` widget or the `forced_width`/`forced_height`
-- properties have to be used.
--
-- To have a gradient between 2 colors when the bar reaches a threshold, use
-- the `gears.color` gradients:
--
--@DOC_wibox_widget_progressbar_grad1_EXAMPLE@
--
-- The same goes for multiple solid colors:
--
--@DOC_wibox_widget_progressbar_grad2_EXAMPLE@
--
--@DOC_wibox_widget_defaults_progressbar_EXAMPLE@
--
-- @author Julien Danjou &lt;julien@danjou.info&gt;
@ -37,14 +51,18 @@ local progressbar = { mt = {} }
--
-- If the value is nil, no border will be drawn.
--
-- @DOC_wibox_widget_progressbar_border_color_EXAMPLE@
--
-- @property border_color
-- @tparam color color The border color to set.
-- @tparam gears.color color The border color to set.
-- @propemits true false
-- @propbeautiful
-- @see gears.color
--- The progressbar border width.
--
-- @DOC_wibox_widget_progressbar_border_width_EXAMPLE@
--
-- @property border_width
-- @tparam number border_width
-- @propemits true false
@ -54,14 +72,18 @@ local progressbar = { mt = {} }
--
-- If the value is nil, no border will be drawn.
--
-- @DOC_wibox_widget_progressbar_bar_border_color_EXAMPLE@
--
-- @property bar_border_color
-- @tparam color color The border color to set.
-- @tparam gears.color color The border color to set.
-- @propemits true false
-- @propbeautiful
-- @see gears.color
--- The progressbar inner border width.
--
-- @DOC_wibox_widget_progressbar_bar_border_width_EXAMPLE@
--
-- @property bar_border_width
-- @tparam number bar_border_width
-- @propbeautiful
@ -69,16 +91,20 @@ local progressbar = { mt = {} }
--- The progressbar foreground color.
--
-- @DOC_wibox_widget_progressbar_color_EXAMPLE@
--
-- @property color
-- @tparam color color The progressbar color.
-- @tparam gears.color color The progressbar color.
-- @propemits true false
-- @usebeautiful beautiful.progressbar_fg
-- @see gears.color
--- The progressbar background color.
--
-- @DOC_wibox_widget_progressbar_background_color_EXAMPLE@
--
-- @property background_color
-- @tparam color color The progressbar background color.
-- @tparam gears.color color The progressbar background color.
-- @propemits true false
-- @usebeautiful beautiful.progressbar_bg
-- @see gears.color
@ -119,29 +145,41 @@ local progressbar = { mt = {} }
-- @tparam[opt=true] boolean clip
-- @propemits true false
--- The progressbar to draw ticks. Default is false.
--- The progressbar to draw ticks.
--
-- @DOC_wibox_widget_progressbar_ticks_EXAMPLE@
--
-- @property ticks
-- @tparam boolean ticks
-- @tparam[opt=false] boolean ticks
-- @propemits true false
--- The progressbar ticks gap.
--
-- @DOC_wibox_widget_progressbar_ticks_gap_EXAMPLE@
--
-- @property ticks_gap
-- @tparam number ticks_gap
-- @tparam[opt=1] number ticks_gap
-- @propemits true false
--- The progressbar ticks size.
--
-- @DOC_wibox_widget_progressbar_ticks_size_EXAMPLE@
--
-- @property ticks_size
-- @tparam number ticks_size
-- @tparam[opt=4] number ticks_size
-- @propemits true false
--- The maximum value the progressbar should handle.
--
-- By default, the value is 1. So the content of `value` is
-- a percentage.
--
-- @DOC_wibox_widget_progressbar_max_value_EXAMPLE@
--
-- @property max_value
-- @tparam number max_value
-- @tparam[opt=1] number max_value
-- @propemits true false
-- @see value
--- The progressbar background color.
--
@ -187,10 +225,18 @@ local progressbar = { mt = {} }
--- The progressbar margins.
--
-- The margins are around the progressbar. If you want to add space between the
-- bar and the border, use `paddings`.
--
-- @DOC_wibox_widget_progressbar_margins2_EXAMPLE@
--
-- Note that if the `clip` is disabled, this allows the background to be smaller
-- than the bar.
--
-- See the `clip` example.
-- It is also possible to specify a single number instead of a border for each
-- direction;
--
-- @DOC_wibox_widget_progressbar_margins1_EXAMPLE@
--
-- @property margins
-- @tparam[opt=0] (table|number|nil) margins A table for each side or a number
@ -201,13 +247,21 @@ local progressbar = { mt = {} }
-- @propemits false false
-- @propbeautiful
-- @see clip
-- @see padding
-- @see wibox.container.margin
--- The progressbar padding.
--
-- This is the space between the inner bar and the progressbar outer border.
--
-- Note that if the `clip` is disabled, this allows the bar to be taller
-- than the background.
--
-- See the `clip` example.
-- @DOC_wibox_widget_progressbar_paddings2_EXAMPLE@
--
-- The paddings can also be a single numeric value:
--
-- @DOC_wibox_widget_progressbar_paddings1_EXAMPLE@
--
-- @property paddings
-- @tparam[opt=0] (table|number|nil) padding A table for each side or a number
@ -218,6 +272,7 @@ local progressbar = { mt = {} }
-- @propemits false false
-- @propbeautiful
-- @see clip
-- @see margins
--- The progressbar margins.
--
@ -424,9 +479,15 @@ end
--- Set the progressbar value.
--
-- By default, unless `max_value` is set, it is number between
-- zero and one.
--
-- @DOC_wibox_widget_progressbar_value_EXAMPLE@
--
-- @property value
-- @tparam number value The progress bar value between 0 and 1.
-- @tparam number value The progress bar value.
-- @propemits true false
-- @see max_value
function progressbar:set_value(value)
value = value or 0

View File

@ -0,0 +1,35 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, color in ipairs { {nil}, {"#ff0000"}, {"#00ff00"}, {"#0000ff44"} } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
background_color = color[1],
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = color[1] and '"'..color[1]..'"' or "nil",
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,36 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, color in ipairs { {nil}, {"#ff0000"}, {"#00ff00"}, {"#0000ff44"} } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
bar_border_width = 2,
bar_border_color = color[1],
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = color[1] and '"'..color[1]..'"' or "nil",
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,36 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, width in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
bar_border_width = width,
bar_border_color = "#ff0000",
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = width,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,36 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, color in ipairs { {nil}, {"#ff0000"}, {"#00ff00"}, {"#0000ff44"} } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
border_width = 2,
border_color = color[1],
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = color[1] and '"'..color[1]..'"' or "nil",
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,36 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, width in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
border_width = width,
border_color = "#ff0000",
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = width,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,35 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, color in ipairs { {nil}, {"#ff0000"}, {"#00ff00"}, {"#0000ff44"} } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
color = color[1],
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = color[1] and '"'..color[1]..'"' or "nil",
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,30 @@
--DOC_GEN_IMAGE --DOC_HIDE --DOC_NO_USAGE
local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
parent:add( --DOC_HIDE
wibox.widget {
color = {
type = "linear",
from = { 0 , 0 },
to = { 100, 0 },
stops = {
{ 0 , "#0000ff" },
{ 0.8, "#0000ff" },
{ 1 , "#ff0000" }
}
},
max_value = 1,
value = 1,
forced_height = 20,
forced_width = 100,
paddings = 1,
border_width = 1,
border_color = beautiful.border_color,
widget = wibox.widget.progressbar,
}
) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,40 @@
--DOC_GEN_IMAGE --DOC_HIDE --DOC_NO_USAGE
local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
local l = wibox.layout.fixed.vertical() --DOC_HIDE
l.spacing = 5 --DOC_HIDE
for _, value in ipairs { 0.3, 0.5, 0.7, 1 } do
l:add( --DOC_HIDE
wibox.widget {
color = {
type = "linear",
from = { 0 , 0 },
to = { 100, 0 },
stops = {
{ 0 , "#00ff00" },
{ 0.5, "#00ff00" },
{ 0.5, "#ffff00" },
{ 0.7, "#ffff00" },
{ 0.7, "#ffaa00" },
{ 0.8, "#ffaa00" },
{ 0.8, "#ff0000" },
{ 1 , "#ff0000" }
}
},
max_value = 1,
value = value,
forced_height = 20,
forced_width = 100,
paddings = 1,
border_width = 1,
border_color = beautiful.border_color,
widget = wibox.widget.progressbar,
}
) --DOC_HIDE
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,35 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, margin in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
margins = margin,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = margin,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,28 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local parent = ...
local wibox = require("wibox")
--DOC_HIDE_END
local bg = --DOC_HIDE
wibox.widget {
{
margins = {
top = 4,
bottom = 2,
right = 10,
left = 5
},
value = 0.33,
border_width = 2,
border_color = "#00ff00",
background = "#0000ff",
widget = wibox.widget.progressbar,
},
forced_height = 30, --DOC_HIDE
forced_width = 75, --DOC_hIDE
bg = "#ff0000",
widget = wibox.container.background
}
parent:add(bg) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,35 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, value in ipairs { 0, 10, 42, 999 } do
local pb = --DOC_HIDE
wibox.widget {
value = value,
max_value = 42,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = value.."/42",
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,35 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, padding in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
paddings = padding,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = padding,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,26 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE
local parent = ...
local wibox = require("wibox")
--DOC_HIDE_END
local bg = --DOC_HIDE
wibox.widget {
paddings = {
top = 4,
bottom = 2,
right = 10,
left = 5
},
value = 1,
border_width = 2,
border_color = "#00ff00",
bar_border_wisth = 2,
bar_border_color = "#ffff00",
bor_color = "#ff00ff",
background = "#0000ff",
forced_width = 75, --DOC_HIDE
forced_height = 30, --DOC_HIDE
widget = wibox.widget.progressbar,
}
parent:add(bg) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -18,6 +18,8 @@ parent:add( --DOC_HIDE
},
{
text = "50%",
valign = "center",
align = "center",
widget = wibox.widget.textbox,
},
layout = wibox.layout.stack

View File

@ -0,0 +1,36 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, has_ticks in ipairs { true, false } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
border_width = 2,
ticks = has_ticks,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = tostring(has_ticks),
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,37 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, gap in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
border_width = 2,
ticks = true,
ticks_gap = gap,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = gap,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,37 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, size in ipairs { 0, 2, 4, 6 } do
local pb = --DOC_HIDE
wibox.widget {
value = 0.33,
border_width = 2,
ticks = true,
ticks_size = size,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = size,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,34 @@
--DOC_GEN_IMAGE --DOC_HIDE_START
local parent = ...
local wibox = require("wibox")
local l = wibox.layout.fixed.horizontal()
l.spacing = 5
--DOC_HIDE_END
for _, value in ipairs { 0, 0.2, 0.5, 1 } do
local pb = --DOC_HIDE
wibox.widget {
value = value,
widget = wibox.widget.progressbar,
}
--DOC_HIDE_START
l:add(wibox.widget {
pb,
{
text = value,
align = "center",
widget = wibox.widget.textbox,
},
forced_height = 30,
forced_width = 75,
layout = wibox.layout.stack
})
--DOC_HIDE_END
end
parent:add(l) --DOC_HIDE
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80