summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2022-04-15 17:11:31 -0400
committerGitHub <noreply@github.com>2022-04-15 17:11:31 -0400
commit6ab940db5ced716689cb7e980e67efcc44e733ea (patch)
treefd4b018b3c7384614c2fc974df16f7c297f7b1a9
parentb8e3a861f4829b2c3820e9a40294a3d9125fbf23 (diff)
parent51ddb1efba57b4c41addd3a00b87bce2c2443741 (diff)
Merge pull request #338 from andreaslongo/issue-209
Fix #209: Match space characters in battery status string
-rw-r--r--battery-widget/battery.lua2
-rw-r--r--batteryarc-widget/batteryarc.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index f7f76b5..452d7ef 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -125,7 +125,7 @@ local function worker(user_args)
local battery_info = {}
local capacities = {}
for s in stdout:gmatch("[^\r\n]+") do
- local status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)')
+ local status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)')
if status ~= nil then
table.insert(battery_info, {status = status, charge = tonumber(charge_str)})
else
diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua
index 1b6752a..3d38af4 100644
--- a/batteryarc-widget/batteryarc.lua
+++ b/batteryarc-widget/batteryarc.lua
@@ -89,7 +89,7 @@ local function worker(user_args)
local charge = 0
local status
for s in stdout:gmatch("[^\r\n]+") do
- local cur_status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)')
+ local cur_status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)')
if cur_status ~= nil and charge_str ~=nil then
local cur_charge = tonumber(charge_str)
if cur_charge > charge then