Don't show battery estimate at 0
If we think we're done might as well not show 0h 0min as the estimate and just not show anything.pull/923/head
parent
89ca155c43
commit
31a4aff1f8
|
@ -204,6 +204,10 @@ const std::string waybar::modules::Battery::formatTimeRemaining(float hoursRemai
|
||||||
uint16_t full_hours = static_cast<uint16_t>(hoursRemaining);
|
uint16_t full_hours = static_cast<uint16_t>(hoursRemaining);
|
||||||
uint16_t minutes = static_cast<uint16_t>(60 * (hoursRemaining - full_hours));
|
uint16_t minutes = static_cast<uint16_t>(60 * (hoursRemaining - full_hours));
|
||||||
auto format = std::string("{H} h {M} min");
|
auto format = std::string("{H} h {M} min");
|
||||||
|
if (full_hours == 0 && minutes == 0) {
|
||||||
|
// Migh as well not show "0h 0min"
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if (config_["format-time"].isString()) {
|
if (config_["format-time"].isString()) {
|
||||||
format = config_["format-time"].asString();
|
format = config_["format-time"].asString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue