From fb24e8cb1f9cd7ece865b9f150f2d23101be624d Mon Sep 17 00:00:00 2001 From: "Rene D. Obermueller" Date: Sun, 30 Jun 2024 21:16:52 +0200 Subject: [PATCH 1/2] add hide-empty-text option to hide module whenever output is empty but format is not --- src/modules/custom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index 45e849cc..20d8d934 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -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); From 8eee5687316af4a6c32752e79210f58fee52c499 Mon Sep 17 00:00:00 2001 From: "Rene D. Obermueller" Date: Sun, 30 Jun 2024 21:23:54 +0200 Subject: [PATCH 2/2] manpage for PR #3395 --- man/waybar-custom.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-custom.5.scd b/man/waybar-custom.5.scd index a62c9312..1c09eac9 100644 --- a/man/waybar-custom.5.scd +++ b/man/waybar-custom.5.scd @@ -21,6 +21,10 @@ Addressed by *custom/* The path to a script, which determines if the script in *exec* should be executed. ++ *exec* will be executed if the exit code of *exec-if* equals 0. +*hide-empty-text*: ++ + typeof: bool ++ + Disables the module when output is empty, but format might contain additional static content. + *exec-on-event*: ++ typeof: bool ++ default: true ++