diff options
author | Robby Russell <robby@planetargon.com> | 2013-11-02 10:35:18 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2013-11-02 10:35:18 -0700 |
commit | 0d36ecfe387b164a13899ae2e7ac565b0abd0bbd (patch) | |
tree | 89b774aff92ab50158b17cba36c9e0c71f2933b0 /plugins/osx | |
parent | 90c28b786ae8a8013fc5083e9cf941115152c706 (diff) | |
parent | 500e5a73b61b063f83e1eecbf424e4b3733e59b7 (diff) | |
download | zsh-0d36ecfe387b164a13899ae2e7ac565b0abd0bbd.tar.gz zsh-0d36ecfe387b164a13899ae2e7ac565b0abd0bbd.tar.bz2 zsh-0d36ecfe387b164a13899ae2e7ac565b0abd0bbd.zip |
Merge pull request #2174 from oxnz/master
plugins/osx/osx.plugin.zsh: add itunes function to control itnues from the terminal
Diffstat (limited to 'plugins/osx')
-rw-r--r-- | plugins/osx/osx.plugin.zsh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index dd785f911..608ec3789 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -157,3 +157,37 @@ function trash() { function vncviewer() { open vnc://$@ } + +# iTunes control function +function itunes() { + local opt=$1 + shift + case "$opt" in + launch|play|pause|stop|rewind|resume|quit) + ;; + mute) + opt="set mute to true" + ;; + unmute) + opt="set mute to false" + ;; + next|previous) + opt="$opt track" + ;; + ""|-h|--help) + echo "Usage: itunes <option>" + echo "option:" + echo "\tlaunch|play|pause|stop|rewind|resume|quit" + echo "\tmute|unmute\tcontrol volume set" + echo "\tnext|previous\tplay next or previous track" + echo "\thelp\tshow this message and exit" + return 0 + ;; + *) + print "Unkonwn option: $opt" + return 1 + ;; + esac + osascript -e "tell application \"iTunes\" to $opt" +} + |