Wanted - audio output based on screen output for Linux
I think what I'm asking for is impossible...
I have a Linux laptop with built in speakers and an external monitor with speakers. The laptop connects to the screen via HDMI. I have my Linux desktop set up for dual screens.
If I drag a window from one screen to the other, I want the sound to follow the window.
Is this possible?
A bit more detail
When I have YouTube running on my monitor, I want the sound to come from the monitor.
When I have a video conference running on my laptop screen, I want the sound to come from the laptop's speakers.
POP!_OS running Wayland gives me the option to set the default audio output.
Some apps - mostly video conference apps - let me select the audio output of that app. So I can set the output to my headphones or screen or laptop or Bluetooth speakers or the misconfigured Smart TV next door.
Is this actually what I want?
My laptop usually has a wired headset and a Bluetooth headset connected - along with the built in speakers. What I really want is for my webcam to notice what headset I'm wearing and route audio to that. If I'm not wearing headphones, notice which screen I'm looking at and route audio that way. Except when I'm playing music on one screen and working on a document on a different screen.
Butler. I want a human butler to surreptitiously readjust the sound output based on my subconscious whims.
Stuart Langridge said on twitter.com:
Possible? Yes. Without writing code? I think no. You can route an individual app’s audio to a specific pulseaudio output — pavucontrol or PulseEffects may be able to help there & code can do more — and you can detect window moves. But I don’t think anyone’s made an app to do it