From 7ccd936cefcd11c63387201c8ddaa642ec36889a Mon Sep 17 00:00:00 2001 From: HerrLeStrate Date: Tue, 25 Aug 2020 19:23:30 +0000 Subject: [PATCH] Fixed trouble with state "Not charging" --- battery-widget/battery.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index 919fb605..c42fac41 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -18,6 +18,7 @@ local dpi = require('beautiful').xresources.apply_dpi -- acpi sample outputs -- Battery 0: Discharging, 75%, 01:51:38 remaining -- Battery 0: Charging, 53%, 00:57:43 until charged +-- Battery 0: Not charging, 98% local HOME = os.getenv("HOME") @@ -121,7 +122,7 @@ 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)%%,?(.*)') + local status, charge_str, time = string.match(s, '.+: ([a-zA-Z0-9 ]+), (%d?%d?%d)%%,?(.*)') if status ~= nil then table.insert(battery_info, {status = status, charge = tonumber(charge_str)}) else