Skip to content

Instantly share code, notes, and snippets.

@yanyaoer
Created July 30, 2012 09:19
Show Gist options
  • Save yanyaoer/3205821 to your computer and use it in GitHub Desktop.
Save yanyaoer/3205821 to your computer and use it in GitHub Desktop.
cmus-remote with alfred extensions script
#!/bin/bash
ps=/bin/ps
grep=/usr/bin/grep
tmux=/usr/local/bin/tmux
cmus=/usr/local/bin/cmus
cmus-remote=/usr/local/bin/cmus-remote
sleep=/usr/local/Cellar/coreutils/8.17/libexec/gnubin/sleep
echo {query} # use query like shift $((OPTIND-1))
if [ {query} = 'next' ]; then
cmd=n
elif [ {query} = 'prev' ]; then
cmd=p
elif [ {query} = 'pause' ]; then
cmd=u
fi
if ! $ps aux | $grep cmus | $grep -v grep > /dev/null ; then
$tmux splitw -t 1 cmus & > /dev/null;
$sleep 1;
$cmus-remote -u
else
$cmus-remote -$cmd
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment