add hide-empty-text option to hide module whenever output is empty but format is not

This commit is contained in:
Rene D. Obermueller 2024-06-30 21:16:52 +02:00
parent 64f54e1fce
commit fb24e8cb1f
1 changed files with 1 additions and 1 deletions

View File

@ -162,7 +162,7 @@ auto waybar::modules::Custom::update() -> void {
auto str = fmt::format(fmt::runtime(format_), text_, fmt::arg("alt", alt_), auto str = fmt::format(fmt::runtime(format_), text_, fmt::arg("alt", alt_),
fmt::arg("icon", getIcon(percentage_, alt_)), fmt::arg("icon", getIcon(percentage_, alt_)),
fmt::arg("percentage", percentage_)); fmt::arg("percentage", percentage_));
if (str.empty()) { if ((config_["hide-empty-text"].asBool() && text_.empty()) || str.empty()) {
event_box_.hide(); event_box_.hide();
} else { } else {
label_.set_markup(str); label_.set_markup(str);