summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/sb-mpdup
blob: e6f21b4a0baaf6e573a79ac60da61e56dcb7fb12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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