Battery: Plugged status has higher priority

This commit is contained in:
Eric L 2022-11-04 19:38:05 +00:00
parent 92cc01f401
commit 6477e539d0
1 changed files with 3 additions and 1 deletions

View File

@ -470,7 +470,9 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
} }
} }
if (!adapter_.empty() && status == "Discharging") { // Give `Plugged` higher priority over `Not charging`.
// So in a setting where TLP is used, `Plugged` is shown when the threshold is reached
if (!adapter_.empty() && (status == "Discharging" || status == "Not charging")) {
bool online; bool online;
std::string current_status; std::string current_status;
std::ifstream(adapter_ / "online") >> online; std::ifstream(adapter_ / "online") >> online;