Skip to content

Commit 941e502

Browse files
kressiMic92
authored andcommitted
Readme.md wibox for battery widget example (#33)
* Use wibox for battery widget example * mention color gradient/margin
1 parent 4c082ac commit 941e502

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

README.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -628,16 +628,34 @@ argument
628628

629629
**Battery widget**
630630

631-
```Lua
632-
batwidget = awful.widget.progressbar()
633-
batwidget:set_width(8)
634-
batwidget:set_height(10)
635-
batwidget:set_vertical(true)
636-
batwidget:set_background_color("#494B4F")
637-
batwidget:set_border_color(nil)
638-
batwidget:set_color("#AECF96")
639-
batwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 0, 10 },
640-
stops = {{ 0, "#AECF96" }, { 0.5, "#88A175" }, { 1, "#FF5656" }}})
631+
```lua
632+
batwidget = wibox.widget.progressbar()
633+
634+
-- Create wibox with batwidget
635+
batbox = wibox.widget {
636+
{
637+
max_value = 1,
638+
widget = batwidget,
639+
border_width = 0.5,
640+
border_color = "#000000",
641+
color = {
642+
type = "linear",
643+
from = { 0, 0 },
644+
to = { 0, 30 },
645+
stops = {
646+
{ 0, "#AECF96" },
647+
{ 1, "#FF5656" }
648+
}
649+
}
650+
},
651+
forced_height = 10,
652+
forced_width = 8,
653+
direction = 'east',
654+
color = beautiful.fg_widget,
655+
layout = wibox.container.rotate,
656+
}
657+
batbox = wibox.layout.margin(batbox, 1, 1, 3, 3)
658+
-- Register battery widget
641659
vicious.register(batwidget, vicious.widgets.bat, "$2", 61, "BAT0")
642660
```
643661
updated every 61 seconds, requests the current battery charge

0 commit comments

Comments
 (0)