0

I have two audio output channels:

  • internal speaker
  • headset

I would like to switch between both via a key on the keyboard.

There are some special keys above the number block which I don't use. For example there is a key which opens a calculator.

How could I get this done?

guettli
  • 1,777

2 Answers2

1

I created a script which changes the audio-sink in a round-robin fashion:

https://github.com/guettli/change-audio-sink/blob/main/change-audio-sink.py

You can map this script to a key with your desktop environment.

guettli
  • 1,777
0

As said, on Settings → Keyboard shortcuts you can create a custom one to a command similar to:

bash -c '[[ $(pacmd list-cards | grep "active profile" | cut -d " " -f 3-) = "<output:hdmi-stereo-extra1+input:analog-stereo>" ]] && pacmd set-card-profile 0 "output:analog-stereo+input:analog-stereo" || pacmd set-card-profile 0 "output:hdmi-stereo-extra1+input:analog-stereo"'

Of course you should change the card profiles accordingly of those between you want to toggle.

screenshot

See also.

Pablo Bianchi
  • 15,657