From: Luca CPZ Date: Thu, 26 Jul 2018 11:20:01 +0000 (+0200) Subject: widget.bat: move fallback ac to autodetection function X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/819600e94ac02760ea4399e9dd64eab42beb1f83?hp=89ae5308061ac828b4f5002ba77c069585b1e088 widget.bat: move fallback ac to autodetection function --- 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