1

How can I make indicator-sound showing controls for output that is actually playing?

Whenever I connect my bluetooth headset, I get sound to my headphones as desired, but the Unity indicator control indicator-sound and all my sound control from keyboards are focused on default speaker sounds, not the one currently playing.

This results that when I plug in bluetooth device, it plays but volume control and mute is focused on other output device and to mute or turn down volume, I have to go to sound settings and change Output > Play sound trough.

This is how my settings look like even if sound plays trough bluetooth headset, I have to click Headset to make indicator work with Headset HT1+, but headset is playing sound.

Ubuntu version on this notebook is 15.10.

enter image description here

Mike
  • 5,691
  • @Takkat Thank you, load-module module-switch-on-connect works as desired, it does switch sound and controls too, but only on connect, when I disconnect bluetooth, it does not switch output back to default audio, but thank you for pointing me in this direction, I am going to explore /etc/pulse/default.pa little bit more. – Mike Jan 18 '16 at 11:22
  • 1
    You can mark your default audio as "fallback" with the help of pavucontrol. It should then work as expected, provided you have the necessary default modules loaded (IIRC module-default-device-restore shoudl do that). – Takkat Jan 18 '16 at 11:30

1 Answers1

3

Based on Takkat's comment and question pulseaudio module-switch-on-connect it finally works and when Bluetooth headset is connected, volume controls and sound switches to newly connected device, when disconnected it falls back to default device.

Done by editing /etc/pulse/default.pa and adding these lines:

load-module module-switch-on-connect
set-default-sink "output name"

To get "output name", use pacmd list-sinks | grep name: and copy your desired output name wihtout the < >.

In my case for example it was set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo would set alsa_output.pci-0000_00_1b.0.analog-stereo as default device so when I disconnect headset, it would fallback to it.

Line load-module module-default-device-restore should be present and uncommented in /etc/pulse/default.pa by default, so no need to add it, but if it has to be added, it should be early in the config, there is a notice in the default.pa:

This (module-default-device-restore) should be loaded as early as possible so that subsequent modules that look up the default sink/source get the right value.

Pulseaudio must be restarted to make the changes in config effective. To just test it out effective until next restart, settings are possible with commandpacmd:

$ pacmd set-default-sink "output"
$ pacmd load-module module-switch-on-connect
Mike
  • 5,691