Readme.md wibox for battery widget example (#33)
* Use wibox for battery widget example * mention color gradient/margin
This commit is contained in:
parent
4c082ace6b
commit
941e50294a
38
README.md
38
README.md
|
@ -628,16 +628,34 @@ argument
|
||||||
|
|
||||||
**Battery widget**
|
**Battery widget**
|
||||||
|
|
||||||
```Lua
|
```lua
|
||||||
batwidget = awful.widget.progressbar()
|
batwidget = wibox.widget.progressbar()
|
||||||
batwidget:set_width(8)
|
|
||||||
batwidget:set_height(10)
|
-- Create wibox with batwidget
|
||||||
batwidget:set_vertical(true)
|
batbox = wibox.widget {
|
||||||
batwidget:set_background_color("#494B4F")
|
{
|
||||||
batwidget:set_border_color(nil)
|
max_value = 1,
|
||||||
batwidget:set_color("#AECF96")
|
widget = batwidget,
|
||||||
batwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 0, 10 },
|
border_width = 0.5,
|
||||||
stops = {{ 0, "#AECF96" }, { 0.5, "#88A175" }, { 1, "#FF5656" }}})
|
border_color = "#000000",
|
||||||
|
color = {
|
||||||
|
type = "linear",
|
||||||
|
from = { 0, 0 },
|
||||||
|
to = { 0, 30 },
|
||||||
|
stops = {
|
||||||
|
{ 0, "#AECF96" },
|
||||||
|
{ 1, "#FF5656" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
forced_height = 10,
|
||||||
|
forced_width = 8,
|
||||||
|
direction = 'east',
|
||||||
|
color = beautiful.fg_widget,
|
||||||
|
layout = wibox.container.rotate,
|
||||||
|
}
|
||||||
|
batbox = wibox.layout.margin(batbox, 1, 1, 3, 3)
|
||||||
|
-- Register battery widget
|
||||||
vicious.register(batwidget, vicious.widgets.bat, "$2", 61, "BAT0")
|
vicious.register(batwidget, vicious.widgets.bat, "$2", 61, "BAT0")
|
||||||
```
|
```
|
||||||
updated every 61 seconds, requests the current battery charge
|
updated every 61 seconds, requests the current battery charge
|
||||||
|
|
Loading…
Reference in New Issue