mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-29 00:10:12 +08:00
add itunes function to control itnues from the terminal
This commit is contained in:
parent
c79e5a97a9
commit
500e5a73b6
@ -157,3 +157,37 @@ function trash() {
|
|||||||
function vncviewer() {
|
function vncviewer() {
|
||||||
open vnc://$@
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user