#!/bin/bash STATE="$(mpc | grep -o playing)" NAME="$(basename "$(mpc current)")" notify() { if [[ -n "$STATE" ]]; then notify-send "Currently playing" "${NAME%.*}" else notify-send "MPD is currently paused" fi } case "$1" in "prev") mpc -q prev playerctl -s previous ;; "toggle") mpc -q toggle playerctl -s play-pause ;; "next") mpc -q next playerctl -s next ;; "notify") notify ;; *) echo "[ Error ] Unknown command" ;; esac