OSX keyboard shortcuts for iTunes from outside the application
I listen to music while I work, and it can be tedious to have to locate iTunes to turn my music on/off, which I have to do often. I want to setup shortcuts so I can start/stop my music no matter what application I'm currently in.
I've seen that OSX lets you create application shortcuts, however they don't seem to be working for me for iTunes. I've tried to create a shortcut named 'Play', which matches the name of the command in the iTunes menu exactly, yet when I use the shortcut I just get a standard warning sound from OSX that you get when you're trying to do something that you cannot do.
EDIT: I have found that I can create a shortcut for the 'Stop' command, just not 'Play'. And the 'Stop' shortcut I've created only works when iTunes is the application in focus. So now I'm even more confused.
Here's my shortcut:
And here's the iTunes menu:
Any ideas as to what I might be doing wrong? Or is there another way to go about this?
If you have an Apple keyboard, F8 (or fn-F8) should start or pause playback. If you don't, you might be able to use KeyRemap4MacBook to remap other key combinations to the special F-keys.
Alfred also has some keywords for controlling iTunes, like play
and next
. You can assign shortcts to them by creating a workflow:
You could also assign a shortcut to a script like this:
tell application "iTunes"
if player state is playing then
pause
else
play
end if
end tell
I use scripts like this to jump forward and backward:
try
tell application "iTunes"
set player position to player position + 30
end tell
end try
One simple solution, if you don't have a keyboard with shortcuts, is to set the miniplayer to always stay on top of other windows for a fast click.
Note: Stackoverflow won't let me post pictures of this because my reputation is too low, but it works for me :)
I've found an application that took care of this nicely for me. I should also note that this was made more difficult because I have a non-Mac keyboard, so I couldn't just use OSX's built-in shortcut for iTunes, as that only seems to work on Mac keyboards.
The application is called Quicksilver, here's the link to it: http://qsapp.com/download.php
It took about 1 minute to download and install, and another 1-2 minutes for me to figure out how to make a trigger for iTunes.
Here are the steps I took:
- Download and install Quicksilver
- Make sure to select the iTunes plugin.
- Setup a hotkey that opens Quicksilver. You get to do this on installation, the default hotkey is ^space, which is nice because it's similar to the default of cmd-space that is used for spotlight.
- Open Quicksilver using the hotkey you setup.
- On the top-right of the open dialog there is a upside-down carat symbol (looks like a down arrow), click that and then click Triggers.
- In the Triggers options on the left, click the iTunes icon (if you don't have this then you probably didn't install the optional iTunes plugin I mentioned on step #2).
- Now find 'Play/Pause', check the box next to it, and setup a hotkey by clicking on the hotkey button in that row. Choose whatever shortcut you want and now iTunes will play/pause to your liking.
Not going to help the OP's 2013 computer, but the Touch Bar on the newest MacBook allows this very easily. By default, the button to the left of Brightness opens iTunes controls. Or you can customize it: https://support.apple.com/en-us/HT207055 (custom-added Play/Pause button also works for Spotify and Clementine player and maybe others; I only tested these)
Maybe someone will need to
adjust the volume of iTunes with global keyboard hotkeys.
- In
Automator
create newService
. -
Service receives
= No input. - Search
Run AppleScript
and drag right. - Paste script and save.
- In
System Preferences > Keyboard > Shortcuts > Services
, search your automator script. - Set global keyboard shortcut (e.g. "fn+cmd+f10", "fn+cmd+f11", "fn+cmd+f12")
scripts:
Volume Up (fn+cmd+f12)
tell application "iTunes"
if mute then
set mute to false
end if
set vol to sound volume
set vol to vol + 5
if vol is greater than 100 then
set vol to 100
end if
set the sound volume to vol
end tell
Volume Down (fn+cmd+f11)
tell application "iTunes"
set vol to sound volume
set vol to vol - 10
if vol is less than 0 then
set vol to 0
end if
set the sound volume to vol
end tell
Mute (fn+cmd+f10)
tell application "iTunes"
set mute to not mute
end tell