summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/osx/osx.plugin.zsh10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 390960fdc..044276c1c 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -161,6 +161,15 @@ function itunes() {
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
+ playing)
+ local state=`osascript -e 'tell application "iTunes" to player state as string'`
+ if [ "$state" = "playing" ]; then
+ currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
+ currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
+ echo "Listening to %F{yellow}$currenttrack%f by %F{yellow}$currentartist%f";
+ fi
+ return 0
+ ;;
shuf|shuff|shuffle)
# The shuffle property of current playlist can't be changed in iTunes 12,
# so this workaround uses AppleScript to simulate user input instead.
@@ -199,6 +208,7 @@ EOF
echo "\tnext|previous\tplay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
+ echo "\tplaying\tShow what song is currently playing in iTunes."
echo "\thelp\tshow this message and exit"
return 0
;;