Use adapter status if battery status is inexistent

pull/2494/head
KanuX-14 2023-09-10 15:16:43 -03:00
parent 60611e9c2b
commit 1ff4464b2f
1 changed files with 7 additions and 1 deletions

View File

@ -254,7 +254,13 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
for (auto const& item : batteries_) {
auto bat = item.first;
std::string _status;
/* Check for adapter status if battery is not available */
if(!std::ifstream(bat / "status")) {
std::getline(std::ifstream(adapter_ / "status"), _status);
} else {
std::getline(std::ifstream(bat / "status"), _status);
}
// Some battery will report current and charge in μA/μAh.
// Scale these by the voltage to get μW/μWh.