Skip to content

Instantly share code, notes, and snippets.

@indradhanush
Created March 13, 2021 14:53
Show Gist options
  • Save indradhanush/abcfdf19298e21883db6e771776ef8d0 to your computer and use it in GitHub Desktop.
Save indradhanush/abcfdf19298e21883db6e771776ef8d0 to your computer and use it in GitHub Desktop.
pa-list() { pacmd list-sinks | awk '/index/ || /name:/' ;}
pa-set() {
# list all apps in playback tab (ex: cmus, mplayer, vlc)
inputs=($(pacmd list-sink-inputs | awk '/index/ {print $2}'))
# set the default output device
pacmd set-default-sink $1 &> /dev/null
# apply the changes to all running apps to use the new output device
for i in ${inputs[*]}; do pacmd move-sink-input $i $1 &> /dev/null; done
}
pa-playbacklist() {
# list individual apps
echo "==============="
echo "Running Apps"
pacmd list-sink-inputs | awk '/index/ || /application.name /'
# list all sound device
echo "==============="
echo "Sound Devices"
pacmd list-sinks | awk '/index/ || /name:/'
}
pa-playbackset() {
# set the default output device
pacmd set-default-sink "$2" &> /dev/null
# apply changes to one running app to use the new output device
pacmd move-sink-input "$1" "$2" &> /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment