Custom module - only call label_.set_tooltip_markup if tooltip markup has actually changed - fixes tooltips not appearing at all if a custom module is updating too frequently.

This commit is contained in:
Jordan Leppert 2020-10-31 12:21:51 +00:00
parent 9fa2cc45d2
commit abe1fa5bd4

View File

@ -131,9 +131,13 @@ auto waybar::modules::Custom::update() -> void {
label_.set_markup(str); label_.set_markup(str);
if (tooltipEnabled()) { if (tooltipEnabled()) {
if (text_ == tooltip_) { if (text_ == tooltip_) {
label_.set_tooltip_markup(str); if (label_.get_tooltip_markup() != str) {
label_.set_tooltip_markup(str);
}
} else { } else {
label_.set_tooltip_markup(tooltip_); if (label_.get_tooltip_markup() != tooltip_) {
label_.set_tooltip_markup(tooltip_);
}
} }
} }
auto classes = label_.get_style_context()->list_classes(); auto classes = label_.get_style_context()->list_classes();