X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/ea7b0dd6b131702ca92d30cd6b89114990686c55..43cd98510a33e9f2d50d315a9bfc31ff8d3062c9:/widgets/contrib/tpbat/smapi.lua diff --git a/widgets/contrib/tpbat/smapi.lua b/widgets/contrib/tpbat/smapi.lua index c7f093e..9002585 100644 --- a/widgets/contrib/tpbat/smapi.lua +++ b/widgets/contrib/tpbat/smapi.lua @@ -16,7 +16,6 @@ local tonumber = tonumber local setmetatable = setmetatable local smapi = {} - local apipath = "/sys/devices/platform/smapi" -- Most are readable values, but some can be written to (not implemented, yet?) @@ -82,13 +81,11 @@ function smapi:battery(name) local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time' local mins_left = self:get(time_val) - if mins_left:find("^%d+") == nil - then - return "N/A" - end + if not mins_left:find("^%d+") then return "N/A" end local hrs = math.floor(mins_left / 60) local min = mins_left % 60 + return string.format("%02d:%02d", hrs, min) end