Fix format option for the taskbar module

When using additional format options in addition to {icon} the format is
separated into text before and text after the icon. Each of the texts is
displayed in a separate label one before and one after the image for the
icon.

The code updating the labels on changes used the wrong format strings
when updating the label after the icon.
This commit is contained in:
Till Smejkal 2020-06-24 09:47:34 +02:00
parent 7429d1f9cc
commit b7a8e8e544
1 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar,
with_icon_ = true;
format_after_ = format.substr(6);
} else if (icon_pos == std::string::npos) {
format_after_ = format;
format_before_ = format;
} else {
with_icon_ = true;
format_before_ = format.substr(0, icon_pos);
@ -421,7 +421,7 @@ void Task::update()
}
if (!format_after_.empty()) {
text_after_.set_label(
fmt::format(format_before_,
fmt::format(format_after_,
fmt::arg("title", title_),
fmt::arg("app_id", app_id_),
fmt::arg("state", state_string()),