Add initial pulseaudio module support

This seems to work quite well including hotplugging of devices, changes to
default sinks/sources etc.

So far I only provided percentage values for sink/source since they seem most
useful. Defaults are set to DEFAULT_SINK/DEFAULT_SOURCE which means it will
follow whatever defaults are at the moment (instead of being fixed to a given
device).

One thing currently left unhandled is when pulseaudio/pipewire gets
disconnected/restarted. In such a case we mark the sink/source as offline but
there is no reconnect attempted later.

Added man page + more complex example which includes mixed usage of both input
and output.
This commit is contained in:
Stanislav Ochotnický 2021-09-17 13:29:30 +02:00
parent 6250360c58
commit 04d47cba3c
8 changed files with 566 additions and 2 deletions

View file

@ -226,6 +226,54 @@ bar:
"":
- string: {text: , font: *awesome, foreground: ffffff66}
- string: {text: "{ssid}", foreground: ffffff66}
- pulse:
anchors:
- string: &common {on-click: "pavucontrol"}
- string: &offline {foreground: dc322fff}
- string: &muted {foreground: 839496ff}
- in: &in
- string: {<<: *common, text: "", font: *awesome}
- string: {<<: *common, text: "{source_percent}%"}
- out: &out
- string: {<<: *common, text: "🔊︁", font: *awesome}
- string: {<<: *common, text: "{sink_percent}%"}
- in_muted: &in_muted
- string: {<<: [*common, *muted], text: "", font: *awesome}
- string: {<<: [*common, *muted], text: "{source_percent}%"}
- out_muted: &out_muted
- string: {<<: [*common, *muted], text: "", font: *awesome}
- string: {<<: [*common, *muted], text: "{sink_percent}%"}
content:
map:
tag: sink_online
values:
false:
- string: {<<: [*offline, *common], text: , font: *awesome}
true:
map:
tag: sink_muted
values:
true:
map:
tag: source_muted
values:
true:
- *out_muted
- *in_muted
false:
- *out_muted
- *in
false:
map:
tag: source_muted
values:
true:
- *out
- *in_muted
false:
- *out
- *in
- alsa:
card: hw:PCH
mixer: Master