feat: add tooltip in format replacments

This commit is contained in:
Prakhar Chhalotre
2026-02-10 00:30:03 +05:30
parent 306f970684
commit f96fb53eeb

View File

@ -182,9 +182,10 @@ auto waybar::modules::Custom::update() -> void {
if (tooltipEnabled()) { if (tooltipEnabled()) {
if (tooltip_format_enabled_) { if (tooltip_format_enabled_) {
auto tooltip = config_["tooltip-format"].asString(); auto tooltip = config_["tooltip-format"].asString();
tooltip = fmt::format( tooltip = fmt::format(fmt::runtime(tooltip), fmt::arg("text", text_),
fmt::runtime(tooltip), fmt::arg("text", text_), fmt::arg("alt", alt_), fmt::arg("tooltip", tooltip_), fmt::arg("alt", alt_),
fmt::arg("icon", getIcon(percentage_, alt_)), fmt::arg("percentage", percentage_)); fmt::arg("icon", getIcon(percentage_, alt_)),
fmt::arg("percentage", percentage_));
label_.set_tooltip_markup(tooltip); label_.set_tooltip_markup(tooltip);
} else if (text_ == tooltip_) { } else if (text_ == tooltip_) {
label_.set_tooltip_markup(str); label_.set_tooltip_markup(str);