#!/bin/sh

opts="Fone\nSpeaker\nHDMI"
out=$(printf $opts | wdmenu -p "Output")
vol=$(pamixer --get-volume)

if [ "$out" = "HDMI" ]
then
    pacmd set-card-profile 0 output:hdmi-stereo+input:analog-stereo
elif [ "$out" = "Speaker" ] || [ "$out" = "Fone" ]
then
	pacmd set-card-profile 0 output:analog-stereo+input:analog-stereo

	if [ "$out" = "Speaker" ]
	then
		pacmd set-sink-port @DEFAULT_SINK@ analog-output-speaker
	else
		pacmd set-sink-port @DEFAULT_SINK@ analog-output-headphones
	fi
fi
pamixer --set-volume "$vol"
