#!/bin/bash
#
# SwapInput 1.4.20150427
#   Script for switching default input fallback with PulseAudio.
#   Useful for desktop icon (shortcut to switch between inputs).
#   Made by Ole-Henrik Jakobsen CC BY-SA.
#
# Usage: ./swapinput
#
# Requirements: pulseaudio, zenity

INPUTS=`pactl list sources short | grep input | grep -v monitor`
CHOSEN=`zenity --list --title="Set default fallback" --text="Select which device to use as default fallback" --column="" --column="Name" --column="Driver" --column="Bitrate" --column="Channels" --column="Samples" --column="State" --radiolist --width="1000" --height="200" $INPUTS`

if [ $CHOSEN ]
then
	pacmd set-default-source $CHOSEN
	exit 1
fi

exit 0