Control iTunes using keyboard media keys

Just a quick post: I have had a really bad programming itch ever since I got my new Dell laptop recently. It has a row of media keys to go back, forward, play/pause and stop my music. Unfortunately, these keys only work when iTunes has the focus, which kind of sucks. I decided, finally, to do something about it, and wrote a small program that lets you control iTunes using these media keys, even when it doesn't have focus. The program lives in your system tray, and you can exit it by right-clicking on it.

There are a number of issues with it, and things I could improve, including:

  • It only works on Windows.
  • It requires Java 6.
  • It only works on x86 computers, although if anyone wants, I can make it work on x64 with a little testing.
  • It allows for multiple instances to be run, meaning that if you have two instances running, clicking back on your keyboard will take you back two songs.
  • It doesn't give any song notification, etc - it is just a controller. If people really want song notification, let me know.

As you should note, the amount of code written is actually minimal: this project is mostly just tying together two other libraries, and of course the iTunes COM interface.

There is a zip file here that contains everything - libs, source code, and a batch file that you can use to start the program. Normal lazy programmers license applies: if your computer crashes and burns, send me photos, but please no complaints. If you use it and (dis)like it, let me know!

Cheers,

Jonathan Giles

Thoughts on “Control iTunes using keyboard media keys”