#!/bin/sh

if [ -z "`pgrep -x $1`" ]; then
	$@ &
	if [ "$1" = mpd ]; then
		sleep 1
		mpd-mpris &
		mpd-rpc --no-idle --dont-broadcast-the-paused-state &
		#those tho will kill themselves when mpd gets killed so we're good
	fi
	notify-send $1 "is now enabled"
else
	notify-send $1 "is now disabled"
	pkill $1
fi
