Created
July 30, 2012 09:19
-
-
Save yanyaoer/3205821 to your computer and use it in GitHub Desktop.
cmus-remote with alfred extensions script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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