title: Binding to media keys, block iTunes OS X
body: <p>I've been using the methods described here: <a href="http://weblog.rogueamoeba.com/2007/09/29/" rel="nofollow noreferrer">http://weblog.rogueamoeba.com/2007/09/29/</a></p>
  
  <p>and read this thread: <a href="https://stackoverflow.com/questions/1053351/binding-to-media-keys-on-apple-keyboards-under-osx-10-5">Binding to Media keys on Apple keyboards under OSX 10.5</a></p>
  
  <p>I've overridden the sendEvent class, and can detect media key input. The problem is that iTunes launches when the Play button is pressed. The above mentioned thread states that iTunes hooks into the event somewhere else (unknown), so there isn't a way to block it from getting the Play/Pause(F8) event.</p>
  
  <p>As a workaround, I've been leaving Quicktime Player open with no file. However, on Mountain Lion, Quicktime closes itself after a certain period of inactivity apparently, thus rendering this workaround unviable.</p>
  
  <p>I know applications such as Spotify and MPlayerX have been able to achieve this somehow. They appear to block the event completely, not just for iTunes.</p>
  
  <p>More googling, I found this discussions.apple.com/thread/2122639?start=210&amp;tstart=0 which tracks it down to the Remote Control Daemon making the calls via Applescript. There are some work arounds which removes the execution permission on the rcd daemon (requires sudo, has to be re-run anytime OSX is updated). nomitsu.com/contents/MMFix_src.tgz</p>
  
  <p>Does anyone have any insight as to how they (MPlayerX, Spotify) have been able to do this is a less hacky way?</p>
  
  <p>Thanks for any advice.</p>