This script will cycle to the next available audio output device. It can be tied to a hotkey to easily be triggered. This is handy, for example, for swapping between HDMI audio and headphones.
- Download the
audio-device-switch.shscript and place it in/usr/local/bin. - Make the script executable:
sudo chmod 755 /usr/local/bin/audio-device-switch.sh. - Open the Keyboard Shortcuts settings page, add a new shortcut, tell it to execute
audio-device-switch.sh, and set up your shortcut! - Install the
notify-sendlibrary if you want to see a popup notification when the audio device switches:sudo apt install libnotify-bin.