From 60611e9c2b098b3a7a63417de3624f399e0b8c0b Mon Sep 17 00:00:00 2001 From: KanuX-14 Date: Sun, 10 Sep 2023 14:41:40 -0300 Subject: [PATCH] Fix battery not showing for some devices Adds 'bat-compatibility' boolean checking from configuration file. --- src/modules/battery.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 3ced890d..96dbdbfa 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -100,9 +100,11 @@ void waybar::modules::Battery::refreshBatteries() { } auto dir_name = node.path().filename(); auto bat_defined = config_["bat"].isString(); + bool bat_compatibility = config_["bat-compatibility"].asBool(); if (((bat_defined && dir_name == config_["bat"].asString()) || !bat_defined) && (fs::exists(node.path() / "capacity") || fs::exists(node.path() / "charge_now")) && - fs::exists(node.path() / "uevent") && fs::exists(node.path() / "status") && + fs::exists(node.path() / "uevent") && + (fs::exists(node.path() / "status") || bat_compatibility) && fs::exists(node.path() / "type")) { std::string type; std::ifstream(node.path() / "type") >> type;