From 9c3881f6f8311099bda8ae99486934caad186308 Mon Sep 17 00:00:00 2001 From: Josh Jones Date: Fri, 16 Feb 2024 01:24:22 +0100 Subject: [PATCH] add check for tooltip-format for custom modules --- src/modules/custom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index d628b85d..6c493a58 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -170,6 +170,12 @@ auto waybar::modules::Custom::update() -> void { if (label_.get_tooltip_markup() != str) { label_.set_tooltip_markup(str); } + } else if (config_["tooltip-format"].isString()) { + auto tooltip = config_["tooltip-format"].asString(); + tooltip = fmt::format(fmt::runtime(tooltip), text_, fmt::arg("alt", alt_), + fmt::arg("icon", getIcon(percentage_, alt_)), + fmt::arg("percentage", percentage_)); + label_.set_tooltip_markup(tooltip); } else { if (label_.get_tooltip_markup() != tooltip_) { label_.set_tooltip_markup(tooltip_);