summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2018-12-25 18:47:25 -0500
committerstreetturtle <streetturtle@gmail.com>2018-12-25 18:47:25 -0500
commit35e2cfdb12f38570f9e83f49cf493f1c229f894e (patch)
tree9a8cbad9b9b977f1952abfa5e680810f7883108c
parent98340da95054a6ddc036c94af9f470d3029679a3 (diff)
fix battery widget bug when no status was shown due to missing information from acpi
-rw-r--r--battery-widget/battery.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index a472bbf..d59fdc6 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -77,7 +77,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+)')