feat(custom): escape option
This commit is contained in:
parent
2c411b9848
commit
79b0367e6c
|
@ -124,7 +124,11 @@ void waybar::modules::Custom::parseOutputRaw()
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (getline(output, line)) {
|
while (getline(output, line)) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
text_ = line;
|
if (config_["escape"].isBool() && config_["escape"].asBool()) {
|
||||||
|
text_ = Glib::Markup::escape_text(line);
|
||||||
|
} else {
|
||||||
|
text_ = line;
|
||||||
|
}
|
||||||
tooltip_ = line;
|
tooltip_ = line;
|
||||||
class_ = "";
|
class_ = "";
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
|
@ -144,8 +148,16 @@ void waybar::modules::Custom::parseOutputJson()
|
||||||
std::string line;
|
std::string line;
|
||||||
while (getline(output, line)) {
|
while (getline(output, line)) {
|
||||||
auto parsed = parser_.parse(line);
|
auto parsed = parser_.parse(line);
|
||||||
text_ = parsed["text"].asString();
|
if (config_["escape"].isBool() && config_["escape"].asBool()) {
|
||||||
alt_ = parsed["alt"].asString();
|
text_ = Glib::Markup::escape_text(parsed["text"].asString());
|
||||||
|
} else {
|
||||||
|
text_ = parsed["text"].asString();
|
||||||
|
}
|
||||||
|
if (config_["escape"].isBool() && config_["escape"].asBool()) {
|
||||||
|
alt_ = Glib::Markup::escape_text(parsed["alt"].asString());
|
||||||
|
} else {
|
||||||
|
alt_ = parsed["alt"].asString();
|
||||||
|
}
|
||||||
tooltip_ = parsed["tooltip"].asString();
|
tooltip_ = parsed["tooltip"].asString();
|
||||||
class_ = parsed["class"].asString();
|
class_ = parsed["class"].asString();
|
||||||
if (!parsed["percentage"].asString().empty() && parsed["percentage"].isUInt()) {
|
if (!parsed["percentage"].asString().empty() && parsed["percentage"].isUInt()) {
|
||||||
|
|
Loading…
Reference in New Issue