#!/bin/sh

audio_icon="~/.config/custom_icons/audio.png"
audio_percentage=$(pactl get-sink-volume @DEFAULT_SINK@ | gawk 'match($0, / ([0-9]+)%/, a) {print a[1]}')

# FIXME: this would create an issue on the notification 1527 since it will remove it
# The alternative is storing the id with id=$(notify-send -p ...) and conditionally including the "-r $old_id" (because it locks the id in)
id=1527 # HACK: dirty but works

case $1 in
	"audio_up")
		notify-send -c Audio -r $id -i ~/.config/custom_icons/audio.png "Output Audio volume" "󰶼 Up to $audio_percentage% 󰶼"
		;;
	"audio_down")
		notify-send -c Audio -r $id -i ~/.config/custom_icons/audio.png "Output Audio volume" "󰶹 Down to $audio_percentage% 󰶹"
		;;
	"audio_unmute")
		notify-send -c Audio -r $id -i ~/.config/custom_icons/audio.png "Output Audio" "Unmuted"
		;;
	"audio_mute")
		notify-send -c Audio -r $id -i ~/.config/custom_icons/audio.png "Output Audio" "Muted"
		;;
	"mic_mute")
		notify-send -c Audio -r $id -i ~/.config/custom_icons/audio.png "Input Audio" "Muted"
		;;
	*)
		;;
esac
