From 03132bd2199ebda777e7d47608a4569fcbcac7a5 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 9 Aug 2018 17:30:23 +0200 Subject: [PATCH] feat: add tooltip to battery and memory --- src/modules/battery.cpp | 1 + src/modules/memory.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 2836f54c..12396d46 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -44,6 +44,7 @@ auto waybar::modules::Battery::update() -> void } auto format = _config["format"] ? _config["format"].asString() : "{}%"; _label.set_text(fmt::format(format, total / _batteries.size())); + _label.set_tooltip_text(charging ? "Charging" : "Discharging"); } catch (std::exception &e) { std::cerr << e.what() << std::endl; } diff --git a/src/modules/memory.cpp b/src/modules/memory.cpp index 856bd289..c71a58fc 100644 --- a/src/modules/memory.cpp +++ b/src/modules/memory.cpp @@ -19,6 +19,8 @@ auto waybar::modules::Memory::update() -> void int available = ((double)info.freeram / (double)info.totalram) * 100; auto format = _config["format"] ? _config["format"].asString() : "{}%"; _label.set_text(fmt::format(format, available)); + auto used = (info.totalram - (info.totalram - info.freeram)) / std::pow(1024, 3); + _label.set_tooltip_text(fmt::format("{:.{}f}Gb used", used, 1)); } }