mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 14:42:29 +02:00
Use adapter status if battery status is inexistent
This commit is contained in:
@ -254,7 +254,13 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
|
|||||||
for (auto const& item : batteries_) {
|
for (auto const& item : batteries_) {
|
||||||
auto bat = item.first;
|
auto bat = item.first;
|
||||||
std::string _status;
|
std::string _status;
|
||||||
std::getline(std::ifstream(bat / "status"), _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.
|
// Some battery will report current and charge in μA/μAh.
|
||||||
// Scale these by the voltage to get μW/μWh.
|
// Scale these by the voltage to get μW/μWh.
|
||||||
|
Reference in New Issue
Block a user