#!/bin/bash

SINK="$(pactl get-default-sink)"

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

if [[ -n "$button" ]]
then
	if [[ "$currentport" == "Active Port: analog-output-lineout" ]]
	then
		pactl set-sink-port "$SINK" "analog-output-headphones"
		echo "casque"
	else
		pactl set-sink-port "$SINK" "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
