Advertisement
metalx1000

PulseAudio Output Switcher

Jul 17th, 2016
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. #!/bin/bash
  2. #By Kris Occhipinti
  3. #http://filmsbykris.com
  4. #License: GPlv3
  5. #switches all current programs using Pulseaudio
  6. #between first 2 output devices
  7.  
  8. f="/tmp/pa-sw"
  9.  
  10. if [ -e $f ]
  11. then
  12.   let s="$(cat $f)";
  13. else
  14.   let s=0;
  15. fi
  16.  
  17. pactl list short sink-inputs|awk '{print $1}'|while read p
  18. do
  19.   pacmd move-sink-input $p $s
  20. done
  21.  
  22. echo "Switching to Sink $s"
  23.  
  24. #switch default output for volume controls
  25. pacmd set-default-sink $s
  26.  
  27. if [ $s -gt 0 ]
  28. then
  29.   let s=0
  30. else
  31.   let s++;
  32. fi
  33.  
  34. echo $s > $f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement