N0PasteRecent pastes

Description

Change default Pulseaudio device, including all running programs.
Syntax:
Created: 22.07.2018 | Expires: Never | Hits: 245
Hide line NumbersSelect allDownload as text fileParsed in 0.031 seconds
  1. #!/bin/bash
  2. # Switch PulseAudio ouput device
  3. SCRIPTNAME="${0##*/}"
  4.  
  5. case "$1" in
  6. list)
  7.     echo "--"
  8.     pacmd list-sinks | grep -A 1 "index"
  9. ;;
  10. 1|2)
  11.     # change default audio output device
  12.     pacmd set-default-sink "$1" > /dev/null
  13.     # change audio output device on running programs
  14.     pacmd list-sink-inputs | grep index | while read line
  15.     do
  16.         pacmd move-sink-input "$(echo "$line" | cut -f2 -d' ')" "$1" > /dev/null
  17.     done
  18. ;;
  19. *)
  20.     echo "Usage:"
  21.     echo "List available devices:   $SCRIPTNAME list"
  22.     echo "Change device:            $SCRIPTNAME {Index #}"
  23. ;;
  24. esac
  25.