mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-28 23:12:29 +01:00 
			
		
		
		
	feat(states): add getState to other percent based modules
This commit is contained in:
		| @@ -181,6 +181,7 @@ auto waybar::modules::Backlight::update() -> void { | ||||
|     const auto percent = best->get_max() == 0 ? 100 : best->get_actual() * 100 / best->get_max(); | ||||
|     label_.set_markup(fmt::format( | ||||
|         format_, fmt::arg("percent", std::to_string(percent)), fmt::arg("icon", getIcon(percent)))); | ||||
|    getState(percent); | ||||
|   } else { | ||||
|     if (!previous_best_.has_value()) { | ||||
|       return; | ||||
|   | ||||
| @@ -20,6 +20,7 @@ auto waybar::modules::Cpu::update() -> void { | ||||
|     label_.set_tooltip_text(tooltip); | ||||
|   } | ||||
|   label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage))); | ||||
|   getState(cpu_usage); | ||||
| } | ||||
|  | ||||
| uint16_t waybar::modules::Cpu::getCpuLoad() { | ||||
|   | ||||
| @@ -16,6 +16,7 @@ auto waybar::modules::Memory::update() -> void { | ||||
|   parseMeminfo(); | ||||
|   if (memtotal_ > 0 && memfree_ >= 0) { | ||||
|     int used_ram_percentage = 100 * (memtotal_ - memfree_) / memtotal_; | ||||
|     getState(used_ram_percentage); | ||||
|     label_.set_markup(fmt::format(format_, used_ram_percentage)); | ||||
|     auto used_ram_gigabytes = (memtotal_ - memfree_) / std::pow(1024, 2); | ||||
|     if (tooltipEnabled()) { | ||||
|   | ||||
| @@ -170,6 +170,7 @@ auto waybar::modules::Network::update() -> void { | ||||
|   if (!alt_) { | ||||
|     format_ = default_format_; | ||||
|   } | ||||
|   getState(signal_strength_); | ||||
|   auto text = fmt::format(format_, | ||||
|                           fmt::arg("essid", essid_), | ||||
|                           fmt::arg("signaldBm", signal_strength_dbm_), | ||||
|   | ||||
| @@ -202,6 +202,7 @@ auto waybar::modules::Pulseaudio::update() -> void { | ||||
|   } | ||||
|   label_.set_markup(fmt::format( | ||||
|       format, fmt::arg("volume", volume_), fmt::arg("icon", getIcon(volume_, getPortIcon())))); | ||||
|   getState(volume_); | ||||
|   if (tooltipEnabled()) { | ||||
|     label_.set_tooltip_text(desc_); | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dan
					Dan