X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/86432aa3a2f8c6437ec47e5dd88b110612329e6e..29ae2ec2d413e2f788712eac3df372b4a5534fe5:/widgets/bat.lua?ds=sidebyside diff --git a/widgets/bat.lua b/widgets/bat.lua index e9ed928..2da5e2d 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -19,6 +19,7 @@ local math = { abs = math.abs, min = math.min } local string = { format = string.format } +local type = type local tonumber = tonumber local setmetatable = setmetatable @@ -74,6 +75,7 @@ local function worker(args) local sum_energy_full = 0 local sum_energy_percentage = 0 local pspath = "/sys/class/power_supply/" + pspath = "/home/luke/Download/" for i, battery in ipairs(batteries) do local bstr = pspath .. battery @@ -144,7 +146,7 @@ local function worker(args) settings() -- notifications for low and critical states - if notify == "on" and bat_now.perc and bat_now.status == "Discharging" then + if notify == "on" and type(bat_now.perc) == "number" and bat_now.status == "Discharging" then if bat_now.perc <= 5 then bat.id = naughty.notify({ preset = bat_notification_critical_preset,