Skip to content

Instantly share code, notes, and snippets.

@gpaton
Last active May 24, 2023 17:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpaton/3fac566a84f724fe4e7c to your computer and use it in GitHub Desktop.
Save gpaton/3fac566a84f724fe4e7c to your computer and use it in GitHub Desktop.
Karabiner (KeyRemap4MacBook) remap "Play" OSX Key to launch Spotify
<?xml version="1.0"?>
<root>
<!-- Spotify Path -->
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APP_Spotify</name>
<url type="file">/Applications/Spotify.app</url>
</vkopenurldef>
<!-- Set Spotify definition -->
<appdef>
<appname>SPOTIFY</appname>
<equal>com.spotify.client</equal>
</appdef>
<!-- Use 'Music Play' key to launch Spotify if not ever in the application or ITunes -->
<!-- Else, act as normal play/pause button in Spotify, Itunes -->
<item>
<name>Change Play key to launch Spotify</name>
<identifier>private.play_launch_spotify</identifier>
<not>SPOTIFY, ITUNES</not>
<autogen>
__KeyToKey__,
ConsumerKeyCode::MUSIC_PLAY,
KeyCode::VK_OPEN_URL_APP_Spotify,
</autogen>
</item>
</root>
@nickav
Copy link

nickav commented Mar 22, 2017

Is there a way to make this only open Spotify if it's not open, and otherwise just play/pause music in Spotify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment