From: Luca CPZ Date: Tue, 31 Jul 2018 14:07:30 +0000 (+0200) Subject: widget.bat: fixed ac variable; improved autodetection; #397 X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/907529920f7db2fd602d2204cf2c4f7efbdd64e2?hp=--cc widget.bat: fixed ac variable; improved autodetection; #397 --- 907529920f7db2fd602d2204cf2c4f7efbdd64e2 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