Media actions Prev/Pause/Next don't work (as expected)

Hi, I'm trialling KM, and trying to set up some hotkeys for "Previous", "Pause" and "Next".

My current keyboard has built-in buttons for these, and they'll e.g. pause whatever is playing; Spotify, Youtube, etc. Doesn't matter.
I've been trying to set that up through KM, but for some reason, when I apply the shortcut, it always opens Apple Music (which I don't use).

I've spent quite a bit of time now, searching, playing around with the config, etc, but can't seem to get it to work. Am I missing something?


That action targets iTunes/Music.

Refer to the KM help page by clicking the help option in the gear menu for the action or just visit the KM wiki for the action here; action:Play a Specific Track [Keyboard Maestro Wiki] for explanation.

What you need to do is use the Type a Keystroke action to simulate pressing the media keys themselves. See the KM wiki action:Type a Keystroke [Keyboard Maestro Wiki]

The problem they'll probably run into is this: I don't think you can trap the media keys, because they activate when pressed, even when you're in the field to assign the key to send. And I don't think you can remap them anywhere first, i.e. so they don't trigger while you assign them.

But that may just be my non-Apple keyboard, so it's worth a shot to try.


1 Like

Thanks! I've read through both pages, and it makes sense, however it's still not clear how to actually record the specific keystrokes for the actions that I need.

I've tried pressing the Pause button on both my external keyboard, and my laptop keyboard, but in both cases, it doesn't record the keystroke, it only records other keys.

Is there a guide somewhere on how to do this? This must be one of the most common usages of KM?

I'm currently looking at replacing my external keyboard, and the new keyboard doesn't have the media keys built it, so I need a way to record this on a new keyboard that doesn't have the buttons

That'll teach me to try solving problems I know little about when I'm nowhere near my Mac :wink:

I suspect you're right, though - thanks for the input :+1:

1 Like

The challenge is that those keys operate below the level of applications, so they can't see them to trap them, because the OS grabs and acts on them first.

[See below for the best answer!]


Ok - KM to the rescue:

Try using the Simulate Hardware Key action - look here in the wiki action:Simulate Hardware Key [Keyboard Maestro Wiki]

That sounds like it should do the trick :hand_with_index_finger_and_thumb_crossed:


OMG I totally forgot about that! Nice catch!



YES! :slight_smile: Thanks, that works a charm, so easy, yet hard to find :upside_down_face:
I feel like the "Music Control" actions should really be targeting these hardware buttons

1 Like