possible fix for #62

This commit is contained in:
streetturtle 2018-12-19 21:18:58 -05:00
parent 293916e80f
commit 855677d667
1 changed files with 3 additions and 1 deletions

View File

@ -48,7 +48,9 @@ watch("acpi -i", 10,
local capacities = {}
for s in stdout:gmatch("[^\r\n]+") do
local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?.*')
if status ~= nil then
if string.match(s, 'rate information') then
-- ignore such line
elseif status ~= nil then
table.insert(battery_info, {status = status, charge = tonumber(charge_str)})
else
local cap_str = string.match(s, '.+:.+last full capacity (%d+)')