diff --git a/man/waybar-cpu.5.scd b/man/waybar-cpu.5.scd index fbf6206f..679ca2ce 100644 --- a/man/waybar-cpu.5.scd +++ b/man/waybar-cpu.5.scd @@ -20,6 +20,11 @@ The *cpu* module displays the current cpu utilization. default: {usage}% ++ The format, how information should be displayed. On {} data gets inserted. +*format-icons*: ++ + typeof: array/object ++ + Based on the current usage, the corresponding icon gets selected. ++ + The order is *low* to *high*. Or by the state if it is an object. + *max-length*: ++ typeof: integer ++ The maximum length in character the module should display. diff --git a/man/waybar-memory.5.scd b/man/waybar-memory.5.scd index 3ff4c35b..0639c07c 100644 --- a/man/waybar-memory.5.scd +++ b/man/waybar-memory.5.scd @@ -22,6 +22,11 @@ Addressed by *memory* default: {percentage}% ++ The format, how information should be displayed. +*format-icons*: ++ + typeof: array/object ++ + Based on the current percentage, the corresponding icon gets selected. ++ + The order is *low* to *high*. Or by the state if it is an object. + *rotate*: ++ typeof: integer ++ Positive value to rotate the text label. diff --git a/src/modules/cpu/common.cpp b/src/modules/cpu/common.cpp index 2ca74212..767cde92 100644 --- a/src/modules/cpu/common.cpp +++ b/src/modules/cpu/common.cpp @@ -26,9 +26,11 @@ auto waybar::modules::Cpu::update() -> void { event_box_.hide(); } else { event_box_.show(); + auto icons = std::vector{state}; label_.set_markup(fmt::format(format, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage), + fmt::arg("icon", getIcon(cpu_usage, icons)), fmt::arg("max_frequency", max_frequency), fmt::arg("min_frequency", min_frequency), fmt::arg("avg_frequency", avg_frequency))); diff --git a/src/modules/memory/common.cpp b/src/modules/memory/common.cpp index 09ce8e83..31219ed6 100644 --- a/src/modules/memory/common.cpp +++ b/src/modules/memory/common.cpp @@ -38,8 +38,10 @@ auto waybar::modules::Memory::update() -> void { event_box_.hide(); } else { event_box_.show(); + auto icons = std::vector{state}; label_.set_markup(fmt::format(format, used_ram_percentage, + fmt::arg("icon", getIcon(used_ram_percentage, icons)), fmt::arg("total", total_ram_gigabytes), fmt::arg("percentage", used_ram_percentage), fmt::arg("used", used_ram_gigabytes),