Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BATTERY --
- -- {{{ Battery state
- -- Initialize widget
- batwidget = widget({ type = "textbox" })
- -- Register widget
- vicious.register(batwidget, vicious.widgets.bat,
- function (widget, args)
- if args[2] == 100 then
- return "Bat: <span color='#9acd32'>A/C</span>"
- elseif args[2] >= 75 and args[2] < 95 then
- return "Bat: <span color='#9acd32'>" .. args[2] .. "%</span>"
- elseif args[2] >= 50 and args[2] < 75 then
- return "Bat: <span color='#d79b1e'>" .. args[2] .. "%</span>"
- elseif args[2] >= 20 and args[2] < 50 then
- return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
- elseif args[2] < 20 and args[1] == "-" then
- naughty.notify({ title = "Battery Warning", text = "Battery low! "..args[2].."% left!\nBetter get some power.", timeout = 10, position = "top_right", fg = bea
- utiful.fg_urgent, bg = beautiful.bg_urgent })
- return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
- elseif args[2] < 20 then
- return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
- else
- return "Bat: <span color='#9acd32'>" .. args[2] .. "%</span>"
- end
- end, 23, "BAT0" )
- -- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement