N0PasteRecent pastes

Description

Change default Pulseaudio device, including all running programs.
Syntax:
Created: 22.07.2018 | Expires: Never | Hits: 212
Show line NumbersSelect allDownload as text fileParsed in 0.405 seconds
#!/bin/bash
# Switch PulseAudio ouput device
SCRIPTNAME="${0##*/}"
 
case "$1" in
list)
    echo "--"
    pacmd list-sinks | grep -A 1 "index"
;;
1|2)
    # change default audio output device
    pacmd set-default-sink "$1" > /dev/null
    # change audio output device on running programs
    pacmd list-sink-inputs | grep index | while read line
    do
        pacmd move-sink-input "$(echo "$line" | cut -f2 -d' ')" "$1" > /dev/null
    done
;;
*)
    echo "Usage:"
    echo "List available devices:   $SCRIPTNAME list"
    echo "Change device:            $SCRIPTNAME {Index #}"
;;
esac