From 15bba301803bec2be7fcd5e826b674f8ed59d7a0 Mon Sep 17 00:00:00 2001 From: Anders Fugmann Date: Mon, 18 Jan 2021 17:47:40 +0100 Subject: [PATCH] Fix ac detection for bat widget. Multiple power sources may exist under /sys/class/power_supply/. Durring autodetection (get_batteries), will case the detected ac to be reset to 'AC0' if a power source not starting with BAT or AC. This change skips updating the name of the ac device if the devices does not start with 'AC' --- widget/bat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/bat.lua b/widget/bat.lua index 891bd76..77324de 100644 --- a/widget/bat.lua +++ b/widget/bat.lua @@ -43,7 +43,7 @@ local function factory(args) if bstr then batteries[#batteries + 1] = bstr else - ac = string.match(line, "A%w+") or "AC0" + ac = string.match(line, "A%w+") or ac end end) end