#!/bin/bash

# declare -A status_icon

case $BLOCK_BUTTON in
    1) mpc toggle &> /dev/null ;;
    3) notify-send "$(mpc)" ;;
esac

status_icon=(["playing"]="" ["paused"]="" ["stopped"]="")
song_name=$(mpc current -f '\[%artist%\] %title%')
if [[ ! -z "$song_name" ]]; then
    mpc status | sed -sn 2p | awk -v NAME="$song_name" '{
        switch ($1) {
            case "[paused]":
                status=""
                break
            case "[playing]":
                status=""
                break
        }
        printf("%s %s %s\n", status, $3, NAME)
        printf("%s\n", status)
    }'
else
    echo ""
fi
