Keyboard – Set Up Global Shortcuts for Media Keys

keyboardshortcutspotify

I've had the (mis)fortune to get a new work laptop with the O' so great Touch Bar which I so immensely hate and have changed the Touch Bar to display F-keys.
However one thing I do miss is my global Media Keys. I'm primarily listen to Spotify and I know it has shortcuts but that requires me to make the Spotify window active which it rarely is.

I've looked into both Google and the shortcut options Apple provides me and I have yet to find a way to set up a global shortcut for the Media Keys (Next, Prev. Play/Pause)

Any help or suggestions would be greatly appreciated.

Best Answer

This solution is a bit of a workaround, but I think that it should work for you.

First, you can write some AppleScripts that will perform the actions Next, Prev., and Play/Pause. I found some examples here. If you are on macOS Catalina, you will need to replace "iTunes" with "Music", unless you only use Spotify and don't want to check for other open applications.

Next, you can create a Quick Action (also known as a service) in Automator. I found some instructions to do that here.

For each AppleScript (Next, Prev, Play/Pause), you can either save it as an application, and set the service to open that application, or you can have your service run the AppleScript directly by using the Run AppleScript variable in Automator.

When you save each service, give it a name (like next, prev, and play), as that will be what shows up in the shortcuts menu.

Now that you have 3 services, you can go to System Preferences -> Keyboard -> Shortcuts -> Services. You can now set a keyboard shortcut to run each service, which in turn should run the AppleScript to perform the Media Action you want. The services you just made should be in the General section, which is at the very bottom of the list for me.