Last active
December 28, 2016 18:09
-
-
Save frafra/8067798 to your computer and use it in GitHub Desktop.
Select default sink for PulseAudio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# select-default-subj.sh | |
# Description: Select default sink for PulseAudio | |
# Author: FraFra (Francesco Frassinelli - frafra.eu) | |
# License: GPLv3 | |
SINKS=($(LC_ALL=C pactl list sinks | grep -P '^\tName: ' | cut -d ' ' -f 2)) | |
DEFAULT=$(LC_ALL=C pactl info | grep '^Default Sink: ' | cut -d ' ' -f 3) | |
echo "Sinks:" | |
i=0 | |
for sink in ${SINKS[@]}; do | |
echo -n "$i) $sink" | |
if [ $sink == $DEFAULT ]; then | |
echo -n " (*)" | |
fi | |
echo | |
let i++ | |
done | |
let i-- | |
echo -n "Select sink ID [0-$i]: " | |
read id | |
pactl set-default-sink ${SINKS[$id]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment