#!/bin/sh # when a command changes MPD state, print it to file for slstatus to pick up [ $(pgrep -cu "$(whoami)" "$(basename "$0")") -gt 1 ] && exit while : ; do if mpc idle > /dev/null; then mpc status > "$XDG_RUNTIME_DIR/mpd.playing" pkill --signal SIGUSR1 slstatus else break fi done