SHARE
TWEET

selectsink.sh

a guest Jan 14th, 2020 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. LANG=C
  4. LC_ALL=C
  5.  
  6. DEST=`zenity --list --column Destination Ordinateur Chaine --text "Peripherique audio"`
  7.  
  8. [ -z "$DEST" ] && exit 0
  9.  
  10. LOCAL=`pacmd list-sinks \
  11.        | grep "name:.*<alsa" \
  12.        | sed 's/.*<\(.*\)>.*/\1/'`
  13.  
  14. REMOTE=`pacmd list-sinks \
  15.         | grep "name:.*Burr-Brown" \
  16.         | sed 's/.*<\(.*\)>.*/\1/'`
  17.  
  18. if [ $DEST = "Ordinateur" ]
  19. then
  20.   pacmd set-default-sink $LOCAL
  21.   SINK=`pacmd list-sinks \
  22.         | grep -B 1 $LOCAL \
  23.         | grep index: \
  24.         | sed 's/.*index: //'`
  25. fi
  26.  
  27. if [ $DEST = "Chaine" ]
  28. then
  29.   pacmd set-default-sink $REMOTE
  30.   SINK=`pacmd list-sinks \
  31.         | grep -B 1 $REMOTE \
  32.         | grep index: \
  33.         | sed 's/.*index: //'`
  34. fi
  35.  
  36. pacmd list-sink-inputs \
  37. | grep index: \
  38. | sed 's/.*index: //' \
  39. | while read i
  40.   do
  41.     pacmd move-sink-input $i $SINK
  42.   done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top