Merge pull request #4114 from Duncaen/cpu-loadavg

cpu: add load{1,5,15} format variables
This commit is contained in:
Alexis Rouillard
2026-07-03 22:17:46 +02:00
committed by GitHub
2 changed files with 9 additions and 0 deletions
+6
View File
@@ -92,6 +92,12 @@ The *cpu* module displays the current CPU utilization.
*{load}*: Current CPU load. *{load}*: Current CPU load.
*{load1}*: CPU load average over the last minute.
*{load5}*: CPU load average over the last 5 minutes.
*{load15}*: CPU load average over the last 15 minutes.
*{usage}*: Current overall CPU usage. *{usage}*: Current overall CPU usage.
*{usage*{n}*}*: Current CPU core n usage. Cores are numbered from zero, so first core will be {usage0} and 4th will be {usage3}. *{usage*{n}*}*: Current CPU core n usage. Cores are numbered from zero, so first core will be {usage0} and 4th will be {usage3}.
+3
View File
@@ -41,6 +41,9 @@ auto waybar::modules::Cpu::update() -> void {
auto icons = std::vector<std::string>{state}; auto icons = std::vector<std::string>{state};
fmt::dynamic_format_arg_store<fmt::format_context> store; fmt::dynamic_format_arg_store<fmt::format_context> store;
store.push_back(fmt::arg("load", load1)); store.push_back(fmt::arg("load", load1));
store.push_back(fmt::arg("load1", load1));
store.push_back(fmt::arg("load5", load5));
store.push_back(fmt::arg("load15", load15));
store.push_back(fmt::arg("usage", total_usage)); store.push_back(fmt::arg("usage", total_usage));
store.push_back(fmt::arg("icon", getIcon(total_usage, icons))); store.push_back(fmt::arg("icon", getIcon(total_usage, icons)));
store.push_back(fmt::arg("max_frequency", max_frequency)); store.push_back(fmt::arg("max_frequency", max_frequency));