diff --git a/resources/config b/resources/config index a62f7c4..f4ec2ff 100644 --- a/resources/config +++ b/resources/config @@ -96,6 +96,7 @@ "format": "{capacity}% {icon}", "format-charging": "{capacity}% ", "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", // "format-good": "", // An empty format will hide the module // "format-full": "", "format-icons": ["", "", "", "", ""] diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index bd287d4..09e82a6 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -91,9 +91,12 @@ const std::tuple waybar::modules::Battery::getInfos std::string _status; std::ifstream(bat / "capacity") >> capacity; std::ifstream(bat / "status") >> _status; - std::ifstream(bat / "power_now") >> power_now; - std::ifstream(bat / "energy_now") >> energy_now; - std::ifstream(bat / "energy_full") >> energy_full; + auto rate_path = fs::exists(bat / "current_now") ? "current_now" : "power_now"; + std::ifstream(bat / rate_path) >> power_now; + auto now_path = fs::exists(bat / "charge_now") ? "charge_now" : "energy_now"; + std::ifstream(bat / now_path) >> energy_now; + auto full_path = fs::exists(bat / "charge_full") ? "charge_full" : "energy_full"; + std::ifstream(bat / full_path) >> energy_full; if (_status != "Unknown") { status = _status; }