summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-01-14 08:54:05 -0500
committerGitHub <noreply@github.com>2020-01-14 08:54:05 -0500
commitf76542848c12dac19727d0c363aaa5604a51f917 (patch)
tree319c2e0c8f4f4e756b829f5d6f8452f8a4f04948
parent17d963d7c524a65c80d93c0b8949b8e224d7d90a (diff)
parent95cc9b942297b8f0cd16b1eb4d336a5e5643681e (diff)
Merge pull request #108 from umar456/fix_regex
Remove extra branch that broke when "rate information unavailable"
-rw-r--r--batteryarc-widget/batteryarc.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua
index bff861e..315aca7 100644
--- a/batteryarc-widget/batteryarc.lua
+++ b/batteryarc-widget/batteryarc.lua
@@ -68,10 +68,8 @@ local function worker(args)
local battery_info = {}
local capacities = {}
for s in stdout:gmatch("[^\r\n]+") do
- local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?.*')
- if string.match(s, 'rate information') then
- -- ignore such line
- elseif status ~= nil then
+ local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)')
+ if status ~= nil then
table.insert(battery_info, { status = status, charge = tonumber(charge_str) })
else
local cap_str = string.match(s, '.+:.+last full capacity (%d+)')