From 38a7e04b9346845fc66a2cebdb4643c780f27d7a Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Wed, 7 Aug 2024 00:39:35 -0700 Subject: [PATCH] Fix battery showing at 0% if no battery is present --- eww/eww-battery-monitor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eww/eww-battery-monitor b/eww/eww-battery-monitor index f79455b..d5ae9c7 100755 --- a/eww/eww-battery-monitor +++ b/eww/eww-battery-monitor @@ -72,7 +72,9 @@ function parse_record(record, exit_on_absent) { } } name = props["native-path"] - if ((! BATTERY && props["power supply"] == "yes" && \ + if (name == "") { + return 0 + } else if ((! BATTERY && props["power supply"] == "yes" && \ props["native-path"] ~ /BAT[0-9]+/) || name == BATTERY) { state_info["percentage"] = props["percentage"] + 0 return 1