> Projects > CatchMediaKeys


CatchMediaKeys is a GPL'ed MacOS X application to grab the events sent by the Runtimte whenever a mediakey is pressed on the newer Apple keyboards. You can in principle bind any command to these if you change the source slightly. I had a lot of trouble finding any other app that could do this so here you go. I hope this helps someone.
At the Moment CMK supports remote and local mpds, cmus and moc but it should be trivial to change this to some other player as well if you prefer some other one.


I hate iTunes and I need a player with global hotkeys. I wasn't satisfied with cog, spotify is not available in my Country and songbird's global hotkey Plugin was broken at that time (plus it's an insane monster, have a look at the build system). I then looked at the source of cog and the old songbird plugin and while researching some of the function calls, I came across this BlogPost. This was too sketchy for me (i have never done Objective-C before) and i searched around more and after 3 Days i had what you can now download here.


version 0.2, source. (Supports moc as well now)
version 0.1, source.
I toyed with the idea of having a config file, to have it call any media-player or even any app but then i figured that changing the source and recompiling is probably more feasible since you probably need to change other stuff too. If you need that functionality or want to tell me that my code is horrible (it is, the CS students won't stop telling me), drop me a line.

How? (do i use it)

The default is like follows. The Keys are Previous, Play, Next, Mute, LowerV, HigherV and Eject, in that order from the middle of the top row, left to right.
key-combo function
previous previous Song
play starts playing if stopped or paused and pauses if the player already plays
next next Song
shift+previous seeks backward by 10 seconds (default)
shift+play play (i.e. don't toggle between pause and play
shift+next seeks forward by 10 seconds (default)
shift+eject restart player (this only kills it for cmus since it needs an attached terminal)
ctrl+play switch player (default order is cmus,moc,remote-mpd,local-mpd
option+previous lower (system) volume by 2%
option+play toggle repeat song (i.e. just play this one song!)
option+next raise (system) volume by 2%
option+eject toggle repeat
cmd+previous playmode: play all songs from library (careful this can take a bit on mpd on huge libraries)
cmd+play playmode: play all songs from the current artist
cmd+next playmode: play all songs from the current album
cmd+eject toggle random

What else

Itunes is really pesky about wanting to grab those media keys. It will start if you press the play key and is not up yet! Every, single time! There are four solutions I've read about so far, three of which are explained here and the one that I think is best here