tooltip-format spaces breaks pango format

Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
This commit is contained in:
Viktar Lukashonak 2023-07-29 23:46:35 +03:00
parent d3520536c4
commit 106535e3eb
No known key found for this signature in database
GPG Key ID: 08A413AA87200A6F

View File

@ -53,15 +53,15 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
// on update.
if (config_["tooltip-format"].isString()) {
std::string trimmed_format{config_["tooltip-format"].asString()};
fmtMap_.insert({5, trimmed_format});
trimmed_format.erase(std::remove_if(trimmed_format.begin(), trimmed_format.end(),
[](unsigned char x) { return std::isspace(x); }),
trimmed_format.end());
fmtMap_.insert({5, trimmed_format});
if (fmtMap_[5].find("{" + kCalendarPlaceholder + "}") != std::string::npos) {
if (trimmed_format.find("{" + kCalendarPlaceholder + "}") != std::string::npos) {
is_calendar_in_tooltip_ = true;
}
if (fmtMap_[5].find("{" + KTimezonedTimeListPlaceholder + "}") != std::string::npos) {
if (trimmed_format.find("{" + KTimezonedTimeListPlaceholder + "}") != std::string::npos) {
is_timezoned_list_in_tooltip_ = true;
}
}