Advertisement
Guest User

Untitled

a guest
Nov 12th, 2011
1,187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. -- BATTERY --
  2. -- {{{ Battery state
  3. -- Initialize widget
  4. batwidget = widget({ type = "textbox" })
  5. -- Register widget
  6. vicious.register(batwidget, vicious.widgets.bat,
  7. function (widget, args)
  8. if args[2] == 100 then
  9. return "Bat: <span color='#9acd32'>A/C</span>"
  10. elseif args[2] >= 75 and args[2] < 95 then
  11. return "Bat: <span color='#9acd32'>" .. args[2] .. "%</span>"
  12. elseif args[2] >= 50 and args[2] < 75 then
  13. return "Bat: <span color='#d79b1e'>" .. args[2] .. "%</span>"
  14. elseif args[2] >= 20 and args[2] < 50 then
  15. return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
  16. elseif args[2] < 20 and args[1] == "-" then
  17. naughty.notify({ title = "Battery Warning", text = "Battery low! "..args[2].."% left!\nBetter get some power.", timeout = 10, position = "top_right", fg = bea
  18. utiful.fg_urgent, bg = beautiful.bg_urgent })
  19. return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
  20. elseif args[2] < 20 then
  21. return "Bat: <span color='#ff4b4b'>" .. args[2] .. "%</span>"
  22. else
  23. return "Bat: <span color='#9acd32'>" .. args[2] .. "%</span>"
  24. end
  25. end, 23, "BAT0" )
  26.  
  27. -- }}}
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement