summaryrefslogtreecommitdiff
path: root/awesome/rc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'awesome/rc.lua')
-rw-r--r--awesome/rc.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua
index f43a08c..a2d032d 100644
--- a/awesome/rc.lua
+++ b/awesome/rc.lua
@@ -128,7 +128,9 @@ for bat = 0, 1 do
local batexists = io.open(batpath)
if batexists~=nil then
io.close(batexists)
- batwidget = wibox.widget.textbox()
+ batwidget_text = wibox.widget.textbox()
+ batwidget = wibox.widget.background()
+ batwidget:set_widget(batwidget_text)
function batstate()
local fcur = io.open(batpath .. '/charge_now')
if not fcur then fcur = io.open(batpath .. '/energy_now') end
@@ -152,10 +154,17 @@ for bat = 0, 1 do
elseif ac:match("0") then
acwidget.visible = false
end
+
local battery = math.floor(cur*100/full)
+ if battery < 10 then
+ batwidget:set_bg(beautiful.bg_urgent)
+ else
+ batwidget:set_bg(beautiful.bg_normal)
+ end
+
return {battery}
end
- vicious.register(batwidget, batstate, ' Bat:$1% ', 60)
+ vicious.register(batwidget_text, batstate, ' Bat:$1% ', 60)
end
end