Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a Mac, when one presses the Press/Play media key (F8), and no application intercepts that key, it opens iTunes and starts playing. Is there any way to get it to open another app? In my case, I want it to open Spotify. Bonus if it's possible to get it to start playing on launch (Maybe AppleScript is the way to go for this?)

share|improve this question
@Lri my question is not a duplicate. I want to know how to make it open Spotify, not just how to keep it from opening iTunes. – Wuffers Nov 18 '11 at 11:16

I know this question is old, but other answers don't really solve the problem.

All you have to do is to install Karabiner (previously known as KeyRemap4MacBook).

Then you just have to add the wanted behavior.

  • Open Preferences menu.
  • Switch to Misc & Uninstall tab
  • Click on Open private.xml
  • Open the file private.xml in your favorite Text Editor
  • Replace the empty file by this definition :

    <?xml version="1.0"?>
        <!-- Spotify Path -->
            <url type="file">/Applications/</url>
        <!-- Set Spotify definition -->
        <!-- Use 'Music Play' key to launch Spotify if not ever in the application -->
        <!-- else, act as normal play/pause button in Spotify, Itunes -->
            <name>Change Play key to launch Spotify</name>
            <not>SPOTIFY, ITUNES</not>
  • Go back to Change Key tab and click on Reload XML button.

  • You now just have to enable the new item added at the top of the list (Screenshot)
share|improve this answer

You might find this useful, too. How to prevent iTunes from launching on media key press

Spotify should respond to F8 by default. How do you get the awesome key icon?

share|improve this answer
All you do is surround the key you want to make into an icon like that with the <kb> HTML tag. – Wuffers Nov 17 '11 at 11:15
And Spotify does respond to F8, but only when it's running. What I want to know is how to make this key launch Spotify if neither it not iTunes are running. – Wuffers Nov 17 '11 at 11:17
Ohh. Hm. Good question! – tekknolagi Nov 18 '11 at 8:45

I would add a custom Keyboard Shortcut to your Function Keys F8-F12.

Normally you would access these function keys by holding fn and the associated Media Key. For example F8 = fn + (Play/Pause on newer Macbook Pros)

In order to make the function keys, rather than their media key functionality, default I would use Function Flip (Free)

share|improve this answer
Or to disable the special key functionality, go into System Preferences -> Keyboard and check "Use All F1, F2, etc, keys as standard function keys". And Voila, they now start showing up as F1, F2, F3, etc... – Benjamin Schollnick Jun 9 '12 at 11:09

To open Spotify and play a song on launch you could do this in AppleScript:

tell application "Spotify"
    play track "spotify:track:trackURI"
end tell

Export this script as an Application with the option "Save as executable script" (or something similar).

Then, to map your f8 key to this script, go to System Preferences, and then under "Keyboard" enable "Use All F1, F2, etc, keys as standard function keys". For the next step, you need to switch to the "Keyboard Shortcuts" tab and add a new Keyboard Shorcut under Applications that will open the AppleScript. (If I remember correctly, you have to reboot your computer or log out for the changes to take place)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .