I've had some success using an autohotkey script* to override the media play/pause key to always control Spotify with the following:
Media_Play_Pause::
WinActivate, ahk_exe spotify.exe
Send {Space}
return
But that of course activates the window.
I tried using
Media_Play_Pause::
ControlSend, , {Space}, ahk_exe spotify.exe
return
instead but it doesn't seem to work.
Any ideas what I'm doing wrong?
* This solves a MS Teams annoyance where it will call the last person you called if you press pause/play