Keep media keys fixed to music

I’m sure there’s a simple solution, but can’t find it.

How do I lock my media keys so they only control music and not the actively playing media (e.g. YouTube)?

one approach I can think of is by using combination of Karabiner Elements and Keyboard Maestro.

  1. In Karabiner, set media key “Play/Pause” to F20 (or any number greater than 12 for convenience)
  2. In Keyboard Maestro, send that key directly to Music.app, or open it if not open yet.

I have similar configuration, but instead, I force the Play/Pause key to send to IINA or Spotify. This will replace the annoying default behavior of Play/Pause key invoking Music.app.


This is what I used to use GitHub - Media Key Forwarder for iTunes and Spotify. The developer kept up with a couple of Apple’s revs of the macOS operating systems, but has now bailed with this message, “I no longer maintain Mac Media Key Forwarder because I moved to Linux. If you have time to maintain it feel free to fork it and write me”

He recommended looking at BeardedSpice, which doesn’t seem to understand the M1 Mac or Big Sur.

1 Like

Thanks for the suggestions! :pray:

I implemented this via BetterTouchTool (BTT).

It intercepts play/skip/back media keypresses and sends the relevant keyboard shortcut to Spotify.

@shandy , are you able to share a screenshot of how you have this set up?

Sure.

1 Like

This is perfect, thanks!

BTT can intercept media keys?? :exploding_head: I never tried that before. I thought as KM (which seems more machine level) cannot intercept media keys, so does BTT (which seems more higher level).

Even with the unavailability of IF-ELSE (that I need to dictate IINA/Spotify/Pocket Casts) that may come in handy. Thanks!

Been waiting for a good replacement for Mac Media Key Forwarder! Since it’s open source I was wondering how difficult it would be to update the app for new OSes, maybe modernise it in Swift… but haven’t had more time to look into this.

1 Like

Go for it and keep us posted.

1 Like

Oh yeah, kinda forgot about this

Someone recompiled the existing MMKF to make it native for Apple Silicon: Releases · kalafalas/macmediakeyforwarder · GitHub

And then a few weeks ago I rewrote all the code in Swift. It all works, just need a name and an icon for it and I’ll put it up on GitHub.

2 Likes