Merge pull request #1636 from IsaacWoods/master

This commit is contained in:
Alex 2022-10-17 09:05:03 +02:00 committed by GitHub
commit c7bb0ae0af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -101,6 +101,10 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
default: 100 ++ default: 100 ++
The maximum volume that can be set, in percentage. 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 # FORMAT REPLACEMENTS
*{desc}*: Pulseaudio port's description, for bluetooth it'll be the device name. *{desc}*: Pulseaudio port's description, for bluetooth it'll be the device name.

View File

@ -170,6 +170,15 @@ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_
if (i == nullptr) return; if (i == nullptr) return;
auto pa = static_cast<waybar::modules::Pulseaudio *>(data); auto pa = static_cast<waybar::modules::Pulseaudio *>(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 (pa->current_sink_name_ == i->name) {
if (i->state != PA_SINK_RUNNING) { if (i->state != PA_SINK_RUNNING) {
pa->current_sink_running_ = false; pa->current_sink_running_ = false;