#!/bin/bash
#By Kris Occhipinti
#http://filmsbykris.com
#License: GPlv3
#switches all current programs using Pulseaudio
#between first 2 output devices
f="/tmp/pa-sw"
if [ -e $f ]
then
let s="$(cat $f)";
else
let s=0;
fi
pactl list short sink-inputs|awk '{print $1}'|while read p
do
pacmd move-sink-input $p $s
done
echo "Switching to Sink $s"
#switch default output for volume controls
pacmd set-default-sink $s
if [ $s -gt 0 ]
then
let s=0
else
let s++;
fi
echo $s > $f