N0PasteRecent pastes

Description

Switch between two pulseaudio devices
Syntax:
Created: 01.12.2018 | Expires: Never | Hits: 241
Hide line NumbersSelect allDownload as text fileParsed in 0.047 seconds
  1. #!/bin/bash
  2. # Switch PulseAudio ouput device
  3. DEFAULT=$(pacmd list-sinks|grep "*"|awk '{ print $3 }')
  4.  
  5. if [ "$DEFAULT" -eq 1 ]; then
  6.     DEV=0
  7. else
  8.     DEV=1
  9. fi
  10.  
  11. pacmd set-default-sink "$DEV" > /dev/null
  12. # change audio output device on running programs
  13. pacmd list-sink-inputs | grep index | while read line
  14. do
  15.     pacmd move-sink-input "$(echo "$line" | cut -f2 -d' ')" "$DEV" > /dev/null
  16. done
  17.