#!/bin/bash


currentport=$(pactl list sinks | grep -Po "Active Port: analog.*")

if [[ -n "$button" ]]
then
	if [[ "$currentport" == "Active Port: analog-output-lineout" ]]
	then
		pactl set-sink-port "alsa_output.pci-0000_0b_00.3.analog-stereo" "analog-output-headphones"
		echo "casque"
	else
		pactl set-sink-port "alsa_output.pci-0000_0b_00.3.analog-stereo" "analog-output-lineout"
		echo "front "
	fi
	pkill -RTMIN+10 i3blocks
else
	if [[ "$currentport" == "Active Port: analog-output-lineout" ]]
	then
		echo "front "
	else
		echo "casque"
	fi
fi