From faf8954712f8276c3196c5eda2622e4ad554fb2c Mon Sep 17 00:00:00 2001 From: Isaac Woods Date: Wed, 27 Jul 2022 01:12:34 +0100 Subject: [PATCH 1/2] Add config option to ignore Pulseaudio Sinks Fixes #1347 --- src/modules/pulseaudio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/pulseaudio.cpp b/src/modules/pulseaudio.cpp index 24b858d..43af2b1 100644 --- a/src/modules/pulseaudio.cpp +++ b/src/modules/pulseaudio.cpp @@ -170,6 +170,15 @@ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_ if (i == nullptr) return; auto pa = static_cast(data); + + if (pa->config_["ignored-sinks"].isArray()) { + for (const auto& ignored_sink : pa->config_["ignored-sinks"]) { + if (ignored_sink.asString() == i->description) { + return; + } + } + } + if (pa->current_sink_name_ == i->name) { if (i->state != PA_SINK_RUNNING) { pa->current_sink_running_ = false; From 6558a156b33d310e9796bc6dc159c200e243890c Mon Sep 17 00:00:00 2001 From: Isaac Woods Date: Fri, 9 Sep 2022 00:52:49 +0100 Subject: [PATCH 2/2] Add man entry for the `ignored-sinks` option --- man/waybar-pulseaudio.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-pulseaudio.5.scd b/man/waybar-pulseaudio.5.scd index 07a0de8..e3f9045 100644 --- a/man/waybar-pulseaudio.5.scd +++ b/man/waybar-pulseaudio.5.scd @@ -101,6 +101,10 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu default: 100 ++ The maximum volume that can be set, in percentage. +*ignored-sinks*: ++ + typeof: array ++ + Sinks in this list will not be shown as the active sink by Waybar. Entries should be the sink's description field. + # FORMAT REPLACEMENTS *{desc}*: Pulseaudio port's description, for bluetooth it'll be the device name.