mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-15 19:48:04 +01:00
Fix #209: Match space characters in battery status string
This commit is contained in:
parent
3975a9d01b
commit
51ddb1efba
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue