Update osx.plugin.zsh
Added function to display the song you're currently listening to in iTunes
Fixed indent
Indentation on line 169 was squiffy
Fixed spelling
Removed unnecessary wording to make function more succinct.
Highlighting of Artist and Track
Changed the highlighting of the Track and Artist in yellow to make use of Prompt Expansion Colors
Diff
1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
2index 390960fdcc162c6701fe0c066772f32d75460bb8..044276c1cfa44d1e1c64cacb6ec308d5fb3d61ec 100644
3--- a/plugins/osx/osx.plugin.zsh
4+++ b/plugins/osx/osx.plugin.zsh
5@@ -161,6 +161,15 @@ function itunes() {
6 vol)
7 opt="set sound volume to $1" #$1 Due to the shift
8 ;;
9+ playing)
10+ local state=`osascript -e 'tell application "iTunes" to player state as string'`
11+ if [ "$state" = "playing" ]; then
12+ currenttrack=`osascript -e 'tell application "iTunes" to name of current track as string'`
13+ currentartist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
14+ echo "Listening to %F{yellow}$currenttrack%f by %F{yellow}$currentartist%f";
15+ fi
16+ return 0
17+ ;;
18 shuf|shuff|shuffle)
19 # The shuffle property of current playlist can't be changed in iTunes 12,
20 # so this workaround uses AppleScript to simulate user input instead.
21@@ -199,6 +208,7 @@ EOF
22 echo "\tnext|previous\tplay next or previous track"
23 echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
24 echo "\tvol\tSet the volume, takes an argument from 0 to 100"
25+ echo "\tplaying\tShow what song is currently playing in iTunes."
26 echo "\thelp\tshow this message and exit"
27 return 0
28 ;;