hide mdp/pulseaudio/sndio if text 'resolves' to be empty.

This commit is contained in:
Prokhor40
2022-12-02 18:08:56 +03:00
parent 2111865efe
commit b74f3c7aaa
3 changed files with 32 additions and 8 deletions

View File

@ -295,10 +295,16 @@ auto waybar::modules::Pulseaudio::update() -> void {
}
}
format_source = fmt::format(format_source, fmt::arg("volume", source_volume_));
label_.set_markup(fmt::format(
auto text = fmt::format(
format, fmt::arg("desc", desc_), fmt::arg("volume", volume_),
fmt::arg("format_source", format_source), fmt::arg("source_volume", source_volume_),
fmt::arg("source_desc", source_desc_), fmt::arg("icon", getIcon(volume_, getPulseIcon()))));
fmt::arg("source_desc", source_desc_), fmt::arg("icon", getIcon(volume_, getPulseIcon())));
if(text.empty()) {
label_.hide();
} else {
label_.set_markup(text);
label_.show();
}
getState(volume_);
if (tooltipEnabled()) {