Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
a51a9169
Commit
a51a9169
authored
Sep 27, 2015
by
Robby Russell
Browse files
Merge pull request #4348 from andybateman/patch-1
Display song currently playing in iTunes
parents
9e291033
326c2b08
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/osx/osx.plugin.zsh
View file @
a51a9169
...
...
@@ -167,6 +167,17 @@ function itunes() {
vol
)
opt
=
"set sound volume to
$1
"
#$1 Due to the shift
;;
playing|status
)
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
-E
"Listening to
$fg
[yellow]
$currenttrack$reset_color
by
$fg
[yellow]
$currentartist$reset_color
"
;
else
echo
"iTunes is"
$state
;
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.
...
...
@@ -205,6 +216,7 @@ EOF
echo
"
\t
next|previous
\t
play next or previous track"
echo
"
\t
shuf|shuffle [on|off|toggle]
\t
Set shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo
"
\t
vol
\t
Set the volume, takes an argument from 0 to 100"
echo
"
\t
playing|status
\t
Show what song is currently playing in iTunes."
echo
"
\t
help
\t
show this message and exit"
return
0
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment