Merge pull request #747 from Jannusch/master

Only real batteries are counted as batteries
pull/556/merge
Alex 2020-06-22 11:31:37 +02:00 committed by GitHub
commit 2c25153506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -53,9 +53,14 @@ void waybar::modules::Battery::getBatteries() {
auto bat_defined = config_["bat"].isString();
if (((bat_defined && dir_name == config_["bat"].asString()) || !bat_defined) &&
fs::exists(node.path() / "capacity") && fs::exists(node.path() / "uevent") &&
fs::exists(node.path() / "status")) {
fs::exists(node.path() / "status") && fs::exists(node.path() / "type")) {
std::string type;
std::ifstream(node.path() / "type") >> type;
if (!type.compare("Battery")){
batteries_.push_back(node.path());
}
}
auto adap_defined = config_["adapter"].isString();
if (((adap_defined && dir_name == config_["adapter"].asString()) || !adap_defined) &&
fs::exists(node.path() / "online")) {