mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 16:02:43 +01:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -200,10 +200,14 @@ const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) c | ||||
| } | ||||
|  | ||||
| const std::string waybar::modules::Battery::formatTimeRemaining(float hoursRemaining) { | ||||
|   hoursRemaining = std::fabs(hoursRemaining); | ||||
|   hoursRemaining = std::fabs(hoursRemaining);  | ||||
|   uint16_t full_hours = static_cast<uint16_t>(hoursRemaining); | ||||
|   uint16_t minutes = static_cast<uint16_t>(60 * (hoursRemaining - full_hours)); | ||||
|   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()) { | ||||
|     format = config_["format-time"].asString(); | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Pedro Côrte-Real
					Pedro Côrte-Real