mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 07:52:42 +01:00 
			
		
		
		
	feat: add tooltip to battery and memory
This commit is contained in:
		| @@ -44,6 +44,7 @@ auto waybar::modules::Battery::update() -> void | ||||
|     } | ||||
|     auto format = _config["format"] ? _config["format"].asString() : "{}%"; | ||||
|     _label.set_text(fmt::format(format, total / _batteries.size())); | ||||
|     _label.set_tooltip_text(charging ? "Charging" : "Discharging"); | ||||
|   } catch (std::exception &e) { | ||||
|     std::cerr << e.what() << std::endl; | ||||
|   } | ||||
|   | ||||
| @@ -19,6 +19,8 @@ auto waybar::modules::Memory::update() -> void | ||||
|     int available = ((double)info.freeram / (double)info.totalram) * 100; | ||||
|     auto format = _config["format"] ? _config["format"].asString() : "{}%"; | ||||
|     _label.set_text(fmt::format(format, available)); | ||||
|     auto used = (info.totalram - (info.totalram - info.freeram)) / std::pow(1024, 3); | ||||
|     _label.set_tooltip_text(fmt::format("{:.{}f}Gb used", used, 1)); | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alexis
					Alexis