Skip to content

Instantly share code, notes, and snippets.

@shkm
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shkm/3afec96261e57c6244d4 to your computer and use it in GitHub Desktop.
Save shkm/3afec96261e57c6244d4 to your computer and use it in GitHub Desktop.
Hook up MPD (MPC) to work with the CM Storm Ninja (And Filcos?) in Karabiner.
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_SHELL_mpc_playpause</name>
<url type="shell">
<![CDATA[
MPC=/usr/local/bin/mpc
if $MPC status | grep -q 'playing'
then
$MPC pause
else
$MPC play
fi
]]>
</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_SHELL_mpc_previous</name>
<url type="shell">
<![CDATA[ /usr/local/bin/mpc prev ]]>
</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_SHELL_mpc_next</name>
<url type="shell">
<![CDATA[ /usr/local/bin/mpc next ]]>
</url>
</vkopenurldef>
<item>
<name>Make Play/Pause work with MPD.</name>
<identifier>private.play_pause_mpd</identifier>
<autogen>
__KeyToKey__
ConsumerKeyCode::MUSIC_PLAY,
KeyCode::VK_OPEN_URL_SHELL_mpc_playpause
</autogen>
</item>
<item>
<name>Make Previous work with MPD.</name>
<identifier>private.mpc_previous</identifier>
<autogen>
__KeyToKey__
ConsumerKeyCode::MUSIC_PREV_0x12,
KeyCode::VK_OPEN_URL_SHELL_mpc_previous
</autogen>
</item>
<item>
<name>Make Next work with MPD.</name>
<identifier>private.mpc_next</identifier>
<autogen>
__KeyToKey__
ConsumerKeyCode::MUSIC_NEXT_0x11,
KeyCode::VK_OPEN_URL_SHELL_mpc_next
</autogen>
</item>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment