Merge pull request #3395 from RobertMueller2/issue_33341

add hide-empty-text option to hide module whenever output is empty but format is not
This commit is contained in:
Alexis Rouillard
2024-07-01 09:20:56 +02:00
committed by GitHub
2 changed files with 5 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_),
fmt::arg("icon", getIcon(percentage_, alt_)),
fmt::arg("percentage", percentage_));
if (str.empty()) {
if ((config_["hide-empty-text"].asBool() && text_.empty()) || str.empty()) {
event_box_.hide();
} else {
label_.set_markup(str);