Merge pull request #5172 from khaneliman/fix/label-markup-cache-pua-collation

fix(label): compare markup cache by raw bytes, not collation
This commit is contained in:
Alexis Rouillard
2026-07-05 09:40:47 +02:00
committed by GitHub
2 changed files with 9 additions and 6 deletions
+5 -2
View File
@@ -87,8 +87,11 @@ class ALabel : public AModule {
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
private:
std::optional<Glib::ustring> last_label_markup_;
std::optional<Glib::ustring> last_tooltip_markup_;
// Raw UTF-8 bytes, not Glib::ustring: ustring::operator== collates with
// g_utf8_collate(), which gives private-use codepoints (nerd-font icons)
// no collation weight, so two different icons compare equal.
std::optional<std::string> last_label_markup_;
std::optional<std::string> last_tooltip_markup_;
};
} // namespace waybar
+4 -4
View File
@@ -147,22 +147,22 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
auto ALabel::update() -> void { AModule::update(); }
bool ALabel::setLabelMarkup(const Glib::ustring& markup) {
if (last_label_markup_ == markup) {
if (last_label_markup_ == markup.raw()) {
return false;
}
label_.set_markup(markup);
last_label_markup_ = markup;
last_label_markup_ = markup.raw();
return true;
}
bool ALabel::setTooltipMarkup(const Glib::ustring& markup) {
if (last_tooltip_markup_ == markup) {
if (last_tooltip_markup_ == markup.raw()) {
return false;
}
label_.set_tooltip_markup(markup);
last_tooltip_markup_ = markup;
last_tooltip_markup_ = markup.raw();
return true;
}