aboutsummaryrefslogtreecommitdiff
path: root/config.dot/awesome.link/battery.lua
blob: 6461b56e9062f543b722e856163d4277128f76b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- See http://blog.lick-me.org/2013/08/yet-another-battery-widget-awesome-3-5-1/
battery_widget = widget({ type = "textbox", name = "battery", align = "right" })

function getBatteryStatus(widget)
   local fd= io.popen(homedir .. "/apps/scripts/battery")
   local status = fd:read()
   fd:close()
   widget.text = status
end

batteryTimer = timer({ timeout = 1 })
batteryTimer:add_signal("timeout", function () getBatteryStatus(battery_widget) end)
batteryTimer:start()