From 819600e94ac02760ea4399e9dd64eab42beb1f83 Mon Sep 17 00:00:00 2001 From: Luca CPZ Date: Thu, 26 Jul 2018 13:20:01 +0200 Subject: [PATCH] widget.bat: move fallback ac to autodetection function --- widget/bat.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/bat.lua b/widget/bat.lua index 8afd6a1..9d5b9ae 100644 --- a/widget/bat.lua +++ b/widget/bat.lua @@ -33,7 +33,7 @@ local function factory(args) end bat.batteries = args.batteries or (args.battery and {args.battery}) or {} - bat.ac = args.ac or "AC0" + bat.ac = args.ac function bat.get_batteries() helpers.line_callback("ls -1 " .. pspath, function(line) @@ -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+") -- fallback one might be wrong + bat.ac = string.match(line, "AC%w+") or "AC0" end end) end -- 2.39.5