Skip to content

Commit

Permalink
Merge pull request #847 from MusiKid/memory-tooltip
Browse files Browse the repository at this point in the history
Add format for memory tooltip
  • Loading branch information
Alexays authored Sep 7, 2020
2 parents 44119db + 225a0ec commit eb53fa8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/modules/memory/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ auto waybar::modules::Memory::update() -> void {
fmt::arg("used", used_ram_gigabytes),
fmt::arg("avail", available_ram_gigabytes)));
if (tooltipEnabled()) {
label_.set_tooltip_text(fmt::format("{:.{}f}Gb used", used_ram_gigabytes, 1));
if (config_["tooltip-format"].isString()) {
auto tooltip_format = config_["tooltip-format"].asString();
label_.set_tooltip_text(fmt::format(tooltip_format,
used_ram_percentage,
fmt::arg("total", total_ram_gigabytes),
fmt::arg("percentage", used_ram_percentage),
fmt::arg("used", used_ram_gigabytes),
fmt::arg("avail", available_ram_gigabytes)));
} else {
label_.set_tooltip_text(fmt::format("{:.{}f}GiB used", used_ram_gigabytes, 1));
}
}
event_box_.show();
} else {
Expand Down

0 comments on commit eb53fa8

Please sign in to comment.