#!/usr/bin/env bash

VOLUME=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}')
MUTE=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -c "MUTED")

if [ "$MUTE" -ne 0 ]; then
    notify-send -h string:x-canonical-private-synchronous:volume \
                -h "int:value:0" \
                -c "osd" \
                "Muted" -i audio-volume-muted
else
    notify-send -h string:x-canonical-private-synchronous:volume \
                -h "int:value:$VOLUME" \
                -c "osd" \
                "Volume: ${VOLUME}%" -i audio-volume-high
fi
