My ThinkPad T450s runs Manjaro. As a scrum master, I frequently move between my desk with two external displays, meeting rooms with no displays, and meeting rooms with one external display. I've installed
autorandr so that the laptop automatically sets up my workspaces according to the available hardware. I love it so much!
But I would also love a similar solution for audio. When at my desk, I want the "fallback devices for both input to be my Bluetooth Jabra headset and for output to be my "simultaneous output to all devices" pseudo-device, but in meeting rooms I will usually connect a USB (Jabra or Logitech) meeting room speakerphone device -- and then I need to go into the Volume Control panel and set up the default devices.
If I could have the whole thing automated, so that newly connected devices would be automatically selected as fallback input/output, that would be so neat!
Caveat: To win the bounty, the answer must describe a solution that works automatically when hardware is plugged in/out. It would be acceptable to trigger a script to run whenever
autorandr runs (but
autorandr itself has no such slipstreaming capability).
Edit: Inspired by @telcoM's answer, I can now include the list of sources and sinks recognized by my system (except the ones in the meeting rooms which I am not currently connected to):
$ pactl list | grep -B 2 'ame:' | grep -A 2 'Sink #' Sink #0 State: SUSPENDED Name: alsa_output.pci-0000_00_1b.0.analog-stereo -- Sink #1 State: SUSPENDED Name: combined -- Sink #43 State: SUSPENDED Name: alsa_output.usb-GN_Netcom_A_S_Jabra_PRO_9470_026D0D98A805-00.analog-mono -- Sink #93 State: SUSPENDED Name: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1
$ pactl list | grep -B 2 'ame:' | grep -A 2 'Source #' Source #0 State: SUSPENDED Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -- Source #1 State: SUSPENDED Name: alsa_input.pci-0000_00_1b.0.analog-stereo -- Source #2 State: SUSPENDED Name: combined.monitor -- Source #46 State: SUSPENDED Name: alsa_output.usb-GN_Netcom_A_S_Jabra_PRO_9470_026D0D98A805-00.analog-mono.monitor -- Source #47 State: SUSPENDED Name: alsa_input.usb-GN_Netcom_A_S_Jabra_PRO_9470_026D0D98A805-00.analog-mono -- Source #97 State: SUSPENDED Name: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1.monitor