I need to get a static output from pw-top, of pipewire, for a script I want to make. I really just need a list of pipewire devices.
For example, I want to be able to run pw-top | grep output and then do stuff to that. Basically, I want to get a list pf pipewire devices and their IDs.
Sort of output I want, for speakers and headphones only:
<device name> <id>
<device name> <id>
<device name> <id>
etc
I tried the following:
[aggam@aggam-archlinux ~]$ pactl list cards | grep -E 'port.type|Name|Card'
Card #39
Name: alsa_card.pci-0000_01_00.1
port.type = "hdmi"
port.type = "hdmi"
port.type = "hdmi"
port.type = "hdmi"
port.type = "hdmi"
port.type = "hdmi"
Card #40
Name: alsa_card.usb-0c76_USB_PnP_Audio_Device-00
port.type = "mic"
Card #41
Name: alsa_card.pci-0000_00_1f.3
port.type = "mic"
port.type = "mic"
port.type = "line"
port.type = "line"
port.type = "headphones"
port.type = "spdif"
But
- some show up as speakers and mics? I assume the headphones are both...
- those are pulseaudio devices, and I want to avoid issues, so I want their pipewire device ID
EDIT 2: my pw-top:
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
S 28 0 0 --- --- --- --- 0 Dummy-Driver
S 29 0 0 --- --- --- --- 0 Freewheel-Driver
S 36 0 0 --- --- --- --- 0 Midi-Bridge
S 42 0 0 --- --- --- --- 0 alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3
S 43 0 0 --- --- --- --- 0 alsa_input.usb-0c76_USB_PnP_Audio_Device-00.mono-fallback
S 44 0 0 --- --- --- --- 0 alsa_output.pci-0000_00_1f.3.analog-stereo
S 45 0 0 --- --- --- --- 0 alsa_input.pci-0000_00_1f.3.analog-stereo
S 71 0 0 --- --- --- --- 0 alsa_output.usb-KURZWEIL_MPS-Piano-00.analog-stereo
S 69 0 0 --- --- --- --- 0 alsa_input.usb-KURZWEIL_MPS-Piano-00.analog-stereo
I 67 0 0 0.0us 0.0us 0.00 0.00 0 F32LE 2 48000 Firefox
notice how the piano output is 71.
output of pactl list short sinks is
42 alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3 PipeWire s32le 2ch 48000Hz SUSPENDED
44 alsa_output.pci-0000_00_1f.3.analog-stereo PipeWire s32le 2ch 48000Hz SUSPENDED
401 alsa_output.usb-KURZWEIL_MPS-Piano-00.analog-stereo PipeWire s16le 2ch 48000Hz SUSPENDED
notice how the piano is 401 all of a sudden...