diff options
author | streetturtle <streetturtle@users.noreply.github.com> | 2020-04-02 21:32:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 21:32:05 -0400 |
commit | 02914db0f21e08380ebf34c293ec7c970edcac45 (patch) | |
tree | d70ad0b50ac6f47348548d2382e40e273d16a7b8 | |
parent | 0d1cfe38429a6daba6838240f037533f836c82c4 (diff) | |
parent | e6993dd131272de5d88fdbed112bc89207414e09 (diff) |
Merge pull request #125 from azhi/fix-battery-acpi-parsing
fix battery widget
-rw-r--r-- | battery-widget/battery.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index b47794d..c066fcc 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -115,10 +115,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+)') |