From 907529920f7db2fd602d2204cf2c4f7efbdd64e2 Mon Sep 17 00:00:00 2001 From: Luca CPZ Date: Tue, 31 Jul 2018 16:07:30 +0200 Subject: [PATCH] widget.bat: fixed ac variable; improved autodetection; #397 --- widget/bat.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/bat.lua b/widget/bat.lua index 03f9a0c..2fece7d 100644 --- a/widget/bat.lua +++ b/widget/bat.lua @@ -41,7 +41,7 @@ local function factory(args) if bstr then bat.batteries[#bat.batteries + 1] = bstr else - bat.ac = string.match(line, "AC%w+") or "AC0" + bat.ac = string.match(line, "A%w+") or "AC0" end end) end @@ -141,7 +141,7 @@ local function factory(args) bat_now.status = status end end - bat_now.ac_status = tonumber(helpers.first_line(string.format("%s%s/online", pspath, ac))) or "N/A" + bat_now.ac_status = tonumber(helpers.first_line(string.format("%s%s/online", pspath, bat.ac))) or "N/A" if bat_now.status ~= "N/A" then if bat_now.status ~= "Full" and sum_rate_power == 0 and bat_now.ac_status == 1 then -- 2.39.5