refactor(tooltip): migrate modules to ALabel generic tooltip helper

Migrate idle_inhibitor, sway/language, sway/scratchpad,
hyprland/language and hyprland/window to the shared label/tooltip
setters. idle_inhibitor uses updateLabelAndTooltipForState; the others
keep their custom label/tooltip resolution (trim, precomputed tooltip,
rewriteString, per-lang/variant formats) and switch to the dedup-aware
setLabelMarkup/setTooltipMarkup.
This commit is contained in:
Alex
2026-07-04 00:00:15 +02:00
parent a91dcbe595
commit db4941efe7
5 changed files with 25 additions and 33 deletions
+3 -3
View File
@@ -124,7 +124,7 @@ auto Language::update() -> void {
fmt::runtime(format_), fmt::arg("short", layout_.short_name),
fmt::arg("shortDescription", layout_.short_description), fmt::arg("long", layout_.full_name),
fmt::arg("variant", layout_.variant), fmt::arg("flag", layout_.country_flag())));
label_.set_markup(display_layout);
setLabelMarkup(display_layout);
if (tooltipEnabled()) {
if (tooltip_format_ != "") {
auto tooltip_display_layout = trim(
@@ -132,9 +132,9 @@ auto Language::update() -> void {
fmt::arg("shortDescription", layout_.short_description),
fmt::arg("long", layout_.full_name), fmt::arg("variant", layout_.variant),
fmt::arg("flag", layout_.country_flag())));
label_.set_tooltip_markup(tooltip_display_layout);
setTooltipMarkup(tooltip_display_layout);
} else {
label_.set_tooltip_markup(display_layout);
setTooltipMarkup(display_layout);
}
}
+2 -2
View File
@@ -31,12 +31,12 @@ Scratchpad::Scratchpad(const std::string& id, const Json::Value& config)
auto Scratchpad::update() -> void {
if (count_ || show_empty_) {
event_box_.show();
label_.set_markup(
setLabelMarkup(
fmt::format(fmt::runtime(format_),
fmt::arg("icon", getIcon(count_, "", config_["format-icons"].size())),
fmt::arg("count", count_)));
if (tooltip_enabled_) {
label_.set_tooltip_markup(tooltip_text_);
setTooltipMarkup(tooltip_text_);
}
} else {
event_box_.hide();