Escape tooltip in custom module

This commit is contained in:
joesri 2024-04-18 14:17:30 +00:00 committed by GitHub
parent 8ef4ddd7ef
commit 2673a5a4f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 2 deletions

View File

@ -214,13 +214,19 @@ void waybar::modules::Custom::parseOutputRaw() {
if (i == 0) { if (i == 0) {
if (config_["escape"].isBool() && config_["escape"].asBool()) { if (config_["escape"].isBool() && config_["escape"].asBool()) {
text_ = Glib::Markup::escape_text(validated_line); text_ = Glib::Markup::escape_text(validated_line);
tooltip_ = Glib::Markup::escape_text(validated_line);
} else { } else {
text_ = validated_line; text_ = validated_line;
tooltip_ = validated_line;
} }
tooltip_ = validated_line; tooltip_ = validated_line;
class_.clear(); class_.clear();
} else if (i == 1) { } else if (i == 1) {
tooltip_ = validated_line; if (config_["escape"].isBool() && config_["escape"].asBool()) {
tooltip_ = Glib::Markup::escape_text(validated_line);
} else {
tooltip_ = validated_line;
}
} else if (i == 2) { } else if (i == 2) {
class_.push_back(validated_line); class_.push_back(validated_line);
} else { } else {
@ -246,7 +252,11 @@ void waybar::modules::Custom::parseOutputJson() {
} else { } else {
alt_ = parsed["alt"].asString(); alt_ = parsed["alt"].asString();
} }
tooltip_ = parsed["tooltip"].asString(); if (config_["escape"].isBool() && config_["escape"].asBool()) {
tooltip_ = Glib::Markup::escape_text(parsed["tooltip"].asString());
} else {
tooltip_ = parsed["tooltip"].asString();
}
if (parsed["class"].isString()) { if (parsed["class"].isString()) {
class_.push_back(parsed["class"].asString()); class_.push_back(parsed["class"].asString());
} else if (parsed["class"].isArray()) { } else if (parsed["class"].isArray()) {