From 51f0fc6b72b72aa28aa8513c4be36ab3e190d713 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Fri, 7 Apr 2023 14:19:45 +1000 Subject: [PATCH] #2094 pulseaudio apply states --- src/modules/pulseaudio.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/pulseaudio.cpp b/src/modules/pulseaudio.cpp index 0630710..586b6cc 100644 --- a/src/modules/pulseaudio.cpp +++ b/src/modules/pulseaudio.cpp @@ -279,7 +279,12 @@ auto waybar::modules::Pulseaudio::update() -> void { label_.get_style_context()->remove_class("muted"); label_.get_style_context()->remove_class("sink-muted"); } - format = config_[format_name].isString() ? config_[format_name].asString() : format; + auto state = getState(volume_, true); + if (!state.empty() && config_[format_name + "-" + state].isString()) { + format = config_[format_name + "-" + state].asString(); + } else if (config_[format_name].isString()) { + format = config_[format_name].asString(); + } } // TODO: find a better way to split source/sink std::string format_source = "{volume}%"; @@ -305,7 +310,6 @@ auto waybar::modules::Pulseaudio::update() -> void { label_.set_markup(text); label_.show(); } - getState(volume_); if (tooltipEnabled()) { if (tooltip_format.empty() && config_["tooltip-format"].isString()) {