Merge pull request #1862 from alebastr/battery-ignore-scope-device
commit
2a76d8e5b9
|
@ -107,6 +107,15 @@ void waybar::modules::Battery::refreshBatteries() {
|
||||||
std::ifstream(node.path() / "type") >> type;
|
std::ifstream(node.path() / "type") >> type;
|
||||||
|
|
||||||
if (!type.compare("Battery")) {
|
if (!type.compare("Battery")) {
|
||||||
|
// Ignore non-system power supplies unless explicitly requested
|
||||||
|
if (!bat_defined && fs::exists(node.path() / "scope")) {
|
||||||
|
std::string scope;
|
||||||
|
std::ifstream(node.path() / "scope") >> scope;
|
||||||
|
if (g_ascii_strcasecmp(scope.data(), "device") == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
check_map[node.path()] = true;
|
check_map[node.path()] = true;
|
||||||
auto search = batteries_.find(node.path());
|
auto search = batteries_.find(node.path());
|
||||||
if (search == batteries_.end()) {
|
if (search == batteries_.end()) {
|
||||||
|
|
Loading…
Reference in New Issue