X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/85ed92417dfca8fbdcfc89b7efb5308edd4d1193..a0da152bb39c5c3ae239a5743c40cb35038c4a21:/widgets/contrib/tpbat/smapi.lua?ds=inline diff --git a/widgets/contrib/tpbat/smapi.lua b/widgets/contrib/tpbat/smapi.lua index 271d9c2..9002585 100644 --- a/widgets/contrib/tpbat/smapi.lua +++ b/widgets/contrib/tpbat/smapi.lua @@ -81,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