fix(custom): stop mixing manual and automatic arg indexing
The current documentation for the custom module suggests mixing manual (`{icon}`) and automatic (`{}`) indexing of format args. Newer versions of the fmt library seem to not support this anymore (see issue #3605). This commit introduces a name for the `text` output of the script, so that `{text}` can now be used instead of `{}` in the configuration.
This commit is contained in:
parent
9cfb1e38fa
commit
3bb3c2d23f
|
@ -159,7 +159,9 @@ auto waybar::modules::Custom::update() -> void {
|
|||
parseOutputRaw();
|
||||
}
|
||||
|
||||
auto str = fmt::format(fmt::runtime(format_), text_, fmt::arg("alt", alt_),
|
||||
auto str = fmt::format(fmt::runtime(format_),
|
||||
fmt::arg("text", text_),
|
||||
fmt::arg("alt", alt_),
|
||||
fmt::arg("icon", getIcon(percentage_, alt_)),
|
||||
fmt::arg("percentage", percentage_));
|
||||
if ((config_["hide-empty-text"].asBool() && text_.empty()) || str.empty()) {
|
||||
|
@ -169,7 +171,9 @@ auto waybar::modules::Custom::update() -> void {
|
|||
if (tooltipEnabled()) {
|
||||
if (tooltip_format_enabled_) {
|
||||
auto tooltip = config_["tooltip-format"].asString();
|
||||
tooltip = fmt::format(fmt::runtime(tooltip), text_, fmt::arg("alt", alt_),
|
||||
tooltip = fmt::format(fmt::runtime(tooltip),
|
||||
fmt::arg("text", text_),
|
||||
fmt::arg("alt", alt_),
|
||||
fmt::arg("icon", getIcon(percentage_, alt_)),
|
||||
fmt::arg("percentage", percentage_));
|
||||
label_.set_tooltip_markup(tooltip);
|
||||
|
|
Loading…
Reference in New Issue