Automatically change sound output device when moving windows between displays

The idea is that it should be possible to link a display with a sound output device, automatically or manually. Then when you move a window between displays it would change the corresponding sound output device automatically.

Does this makes sense? Would it be a useful feature? What happens with applications with multiple windows?

To implement this it would need:

  • Some logic to automatically match a display with a sound device.
  • Add a way to manually configure this (where? sound settings, display settings or both?)
  • Create a virtual audio device per monitor, it would be hidden in the gui, instead you would see “automatic, audio device 1, audio device 2, etc” when choosing the output. Is this possible with pulseaudio, pipewire or both?
  • Lastly the logic of changing the applications sound output device when moving its windows (kwin plugin?)