Fix battery showing at 0% if no battery is present

This commit is contained in:
Alexander Rosenberg 2024-08-07 00:39:35 -07:00
parent cf39ce0c9c
commit 38a7e04b93
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -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