I need to write shell script that will send a Google Chrome instance to a specified monitor and also route the associated sound there.
I can make the instance appear on the right monitor by passing the appropriate --window-position, and I can identify the positions of monitors with xrandr --listactivemonitors. But, how do I go from that to the ALSA device name?
logiclrd@visor:~$ xrandr --listactivemonitors
Monitors: 3
0: +*eDP 2560/345x1600/215+1920+60 eDP
1: +DisplayPort-1 1920/160x1080/90+4480+0 DisplayPort-1
2: +DisplayPort-8 1920/535x1080/339+0+0 DisplayPort-8
logiclrd@visor:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [BenQ BL2581T]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 8: HDMI 2 [SAMSUNG]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: ALC295 Analog [ALC295 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Dock [WD15 Dock], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Dock [WD15 Dock], device 1: USB Audio [USB Audio #1]
Subdevices: 1/1
Subdevice #0: subdevice #0
logiclrd@visor:~$
I see nothing in common :-(
(Is there a different way to tell Chrome where to send its sound (other than manually using a GUI tool to reconfigure the output -- this needs to be automated)?)