Last active
August 29, 2015 14:22
-
-
Save blueyed/87f3fd0578a09a820ba4 to your computer and use it in GitHub Desktop.
battery widget for AwesomeWM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Battery widget {{{ | |
batwidget = awful.widget.progressbar() | |
batwidget:set_width(8) | |
batwidget:set_vertical(true) | |
local batwidget_tooltip = awful.tooltip({ objects = { batwidget }, delay_show = 1, }) | |
vicious.register(batwidget, vicious.widgets.bat, function(widget, args) | |
local state, percent, time, wear = unpack(args) | |
if state == "⌁" or state == "↯" then -- "Unknown" or "Charged" | |
widget:set_width(0) | |
else | |
widget:set_width(8) | |
if percent <= 25 then | |
widget:set_color("#FF5656") | |
else | |
widget:set_color("#AECF96") | |
end | |
end | |
batwidget_tooltip:set_text("bat: " .. state .. " " .. percent .. "%, time:" .. time .. ", wear: " .. wear ) | |
return percent | |
end, 61, "BAT0") | |
-- }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment