#! /bin/sh action="$1" if pgrep smplayer >/dev/null; then if [ "$action" = prev ]; then exec smplayer -send-action play_prev elif [ "$action" = next ]; then exec smplayer -send-action play_next elif [ "$action" = pause ]; then exec smplayer -send-action play_or_pause elif [ "$action" = stop ]; then exec smplayer -send-action stop fi elif pgrep deadbeef >/dev/null; then if [ "$action" = prev ]; then exec deadbeef --prev elif [ "$action" = next ]; then exec deadbeef --next elif [ "$action" = pause ]; then exec deadbeef --play-pause elif [ "$action" = stop ]; then exec deadbeef --stop fi elif pgrep audacious >/dev/null; then if [ "$action" = prev ]; then exec audtool --playlist-reverse elif [ "$action" = next ]; then exec audtool --playlist-advance elif [ "$action" = pause ]; then exec audtool --playback-playpause elif [ "$action" = stop ]; then exec audtool --playback-stop elif [ "$action" = stop-after ]; then exec audtool --playlist-stop-after-toggle fi else echo "Cannot find an audioplayer" >&2 exit 1 fi