Advertisement
liliff

Vicious Battery Widget

Apr 5th, 2012
1,153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. batmon = awful.widget.progressbar()
  2. batmon:set_width(8)
  3. batmon:set_vertical(true)
  4. batmon:set_border_color("#3f3f3f")
  5. batmon:set_color("#5f5f5f")
  6. batmon_t = awful.tooltip({ objects = { batmon.widget },})
  7. vicious.register(batmon, vicious.widgets.bat, function (widget, args)
  8.                 batmon_t:set_text(" State: " .. args[1] .. " | Charge: " .. args[2] .. "% | Remaining: " .. args[3])
  9.                 if args[2] <= 5 then
  10.                         naughty.notify({ text="Battery is low! " .. args[2] .. " percent remaining." })
  11.                 end
  12.                 return args[2]
  13.                 end , 60, "BAT0")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement