aboutsummaryrefslogtreecommitdiff
path: root/config.dot/awesome.link/battery.lua
blob: 5e3523dbcda95b5535e0c05d80b869cb8719f8e3 (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/utils-battery/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()