How can I use the keyboard media controls (play, pause, skip, previous) to only work in Spotify? Not system wide
In the "Keyboard" pane of System Preferences, there is an option to use function keys without having to hold down the "fn" key. This should turn your "media" keys into function keys (except when you press "fn"). You can then use Keyboard Maestro to map the keys (probably you will want to use modifier keys with them) to items in Spotify's "Playback" menu.
I made a couple of reasonable assumptions about your particular setup (type of keyboard, MacOS version) but I hope this helps.
K
That works great, thank you! However one catch…
When I Pause the music via the "Playback" menu, the same menu item changes to “Pause”. And vice versa when it’s paused it displays “Play”. Ideally I’d like to use the same keyboard trigger (F8) to both play & pause. Any idea how I can do this since the menu item changes depending on Spotfy's current playback state?
... and one try! action:Try or Catch [Keyboard Maestro Wiki]
Drag your "play" macro into the first field of that action, and option-drag a copy of it to the second field, and in that copy, rename "play" to "pause". Keep the key trigger the same.
There will be more elegant solutions too.
K.
You're a GENIUS!!!! Thank you!!
For instance..! Send a simulated key press to Spotify. We can see from Spotify's "Playback" menu that the space key is set to play and pause. So we can just use the "Type keystroke" action to simulate the space key, and tell the action that this is aimed at Spotify. See the image at the bottom of this page of the wiki:
https://wiki.keyboardmaestro.com/action/Type_a_Keystroke?s[]=background&s[]=key
I'm expanding my knowledge of Keyboard Maestro a lot at present by reading the forum and the wiki, and of course trying things out. That does not make me (or I guess, most people here?) an expert, so don't take what I say on trust and test even the simplest ideas carefully to make sure they don't have unintended consequences on your setup.
Have fun,
K.