wpctl `list [audio|video] [sinks|sources]` subcommand?
In creating a shell-script-based module for Waybar that allows me to select my preferred audio sink via Wofi (so that i can switch between my laptop speakers, my HDMI output going to an amplifier, several different Bluetooth devices, etc.), i wasn't able to find a way to simply list currently available audio sinks without doing shenanigans with awk and sed, e.g.:
wp_audio_devices() {
wpctl status |
awk 'BEGIN { A=0; D=0; }
/^Audio/ { A=1; }
/Devices/ { D=1; }
/Sinks/ { D=0; }
/^Video/ { A=0; }
{ if (A==1 && D==1 && / [[:digit:]]*\./)
{ print; } }' |
sed 's/^.* \([[:digit:]]*\)\. \(.*\) \[.*$/\1\t\2/'
}
and
wp_audio_sinks() {
wpctl status |
awk 'BEGIN { A=0; S=0; }
/^Audio/ { A=1; }
/Sinks/ { S=1; }
/Sink endpoints/ { S=0; }
/^Video/ { A=0; }
{ if (A==1 && S==1 && / [[:digit:]]*\./)
{ print; } }' |
sed 's/^.* \([[:digit:]]*\)\. \(.*\) \[.*$/\1\t\2/'
}
and so on.
What i would have liked to be able to do is something like:
$ wpctl list audio sinks
35 Living Room
55* Family 17h/19h HD Audio Controller Analog Stereo
64 Easy Effects Sink
with tabs separating the columns, and *
indicating the current default sink.
Have i missed anything along these lines? If not, might it be possible for such subcommands to be implemented? Or is piping of the output of pw-dump to jq, with an appropriate combintation of filters, considered to be the way to handle this?