#!/bin/bash

/bin/sleep 5

if [[ $(autorandr --current) = "mobile" ]]; then
	pacmd set-default-source alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__source
	pacmd set-default-sink alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink
	/bin/sleep 2 && pulseeffects --load-preset "Test" --bypass 2 > /dev/null 2>&1
#	pulseaudio-ctl set 50%
	notify-send "Autorandr" "Mobile Mode"
elif [[ $(autorandr --current) = "docked" ]]; then
	pacmd set-default-source alsa_output.usb-Generic_USB_Audio_200901010001-00.HiFi__hw_Dock__source
	pacmd set-default-sink alsa_output.usb-Generic_USB_Audio_200901010001-00.HiFi__hw_Dock_1__sink
	/bin/sleep 2 && pulseeffects --bypass 1 > /dev/null 2>&1
	pulseaudio-ctl set 100%
	notify-send "Autorandr" "Docked Mode"
fi

pkill xiccd && xiccd &
