Keep Play Pause on Keyboard Linked To Music

If I am playing music on my Mac (which is basically always when I am working on my Mac and not in meetings) and I need to play a video somewhere else (say Youtube), I click the play button in the browser and video starts to play. So I then click Play / Pause on keyboard. What I would like to happen at this time is the music pauses. Unfortunately, it pauses the YouTube video (or whatever video is playing). That is never what I want to happen.

I searched and didn’t see if this was answered already (sorry if I missed it) but is there a way to make sure play pause on keyboard ONLY ever controls music?

I also don’t like that if I am in keynote working on a presentation and it takes over the play pause keyboard keys too. I only ever want those keys to control the music app. Anyone know how to do that?

There used to be tiny apps for this like High Sierra Media Key Enabler, Mac Media Key Forwarder, and BeardedSpice but I don’t know any that work on my M1 MacBook Air.

Alas, all three seem to be abandonware.

There was also a Karabiner Elements rule that I could not get to work. :frowning:

So I wrote a simple AppleScript to play/pause Music that I added to FastScripts and trigger via a hotkey combo. I’m sure it could be triggered by other utilities as well.

1 Like

This doesn’t directly solve your problem in the way you would like it to, so I apologize and I understand your frustration.

What I’ve done to alleviate the problem is run Alfred and Powerpack (Alfred’s paid version). That gives me the ability to hot-key the Music app to Control + Command + Return. That’ll give me the UI in the screenshot below.

At that point, I just start typing “pause” until Alfred lets me pause the music with a quick keystroke.

Obviously, this is way more steps than just hitting the Play/Pause button. 150% agreed, and I would prefer it to work your way. But this at least makes it so I don’t need to take my hands off the keyboard for this mundane task.

1 Like

Yeah, that’s frustrating and I’ll be interested to see if you find a good solution.

I have the same issue, but the reverse of you. I listen to music in Plex in a browser tab all day. Sometimes, I think when it’s been paused for a long time?, I’ll hit the play button on my keyboard and instead of resuming the music in plex it will open the Music app and start playing something randomly from there. Pretty frustrating.

As an interesting coincidence, I had Dream Theater playing when I read this. :slight_smile:

2 Likes

They just played Atlanta. Not my bag, but they are admittedly so good at what they do.

They just played two places close to me, although I did not go. And while I wouldn’t have them as the top item on my list as snelly does, (Pink Floyd and Brian Eno would be at the top) there is some of their stuff I enjoy. One of the few bands that Apple Music suggested that clicked with me.

1 Like

Woah woah woah now, they are not at the top of my list. Let me defend my taste! :wink: But I do like a couple albums of theirs from the 90s.

They just happened to be the random album that Alfred picked this morning when I hit the “random album” button and it vibed with me this morning.

2 Likes

And now that I’m using Touch Portal, I’ve added a button to run that play/pause AppleScript.

So while I’d prefer to have the keyboard key always target Music, I’ve got an acceptable workaround.

And this is the aforementioned AppleScript:

tell application "Music"
	playpause
end tell

As I said, pretty simple.

Could you rig this up to Keyboard Maestro and assign it to run every time you hit the Play/Pause key? Because that’d be the solution for sure.

Maybe. I’ve only recently started using Keyboard Maestro, and am by no means an expert.

But as the forecast calls for rain this weekend in these here parts, I may be stuck inside so it seems I’ve got a project (more fun than yard work!).

Of course, if I had one of those QMK programmable keyboards … (quick, hide my wallet …)

1 Like

I’d love to know how to do this. As far as I can tell, Apple has locked away control of these keys so KM etc cannot use them…

… but while writing this I had a cunning plan.

  1. Switch to use the function keys instead of media keys
  2. Program KM to mimic the media key functions or my preferred variation when the Fn key is pressed

The problem I foresee is I don’t know if I can use KM to bring up Mission Control, but I’ll give it a go.