X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/e73a70c2ab26caf981d356756d4f83ad8bfbdb5a..53208723736b34e4b6c2c23fd77757fd46c436cf:/widgets/bat.lua diff --git a/widgets/bat.lua b/widgets/bat.lua index fa61c34..7b14a9a 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -30,14 +30,14 @@ local function worker(args) bat.widget = wibox.widget.textbox('') - bat_now = { - status = "not present", - perc = "N/A", - time = "N/A", - watt = "N/A" - } - - function bat.update() + function update() + bat_now = { + status = "Not present", + perc = "N/A", + time = "N/A", + watt = "N/A" + } + local present = first_line("/sys/class/power_supply/" .. battery .. "/present") @@ -89,7 +89,7 @@ local function worker(args) ontop = true, replaces_id = bat.id }).id - elseif bat.perc <= 15 + elseif bat_now.perc <= 15 then bat.id = naughty.notify({ text = "plug the cable", @@ -110,7 +110,7 @@ local function worker(args) settings() end - newtimer("bat", timeout, bat.update) + newtimer("bat", timeout, update) return bat.widget end