Skip to content

Commit

Permalink
Merge pull request Alexays#1223 from xi/cpu-mem-format-icon
Browse files Browse the repository at this point in the history
add format-icons for cpu und memory
  • Loading branch information
Alexays committed Aug 23, 2021
2 parents eae94ee + 7b4b5e5 commit 4e256cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions man/waybar-cpu.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-memory.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/modules/cpu/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ auto waybar::modules::Cpu::update() -> void {
event_box_.hide();
} else {
event_box_.show();
auto icons = std::vector<std::string>{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)));
Expand Down
2 changes: 2 additions & 0 deletions src/modules/memory/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ auto waybar::modules::Memory::update() -> void {
event_box_.hide();
} else {
event_box_.show();
auto icons = std::vector<std::string>{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),
Expand Down

0 comments on commit 4e256cf

Please sign in to comment.