Tony Pitale

NSDistributedNotificationCenter in MacRuby

I've started working on MacRuby project, that I'll talk more about later, but I had some fun getting notifications from iTunes about track changes and play/pause events. I found the documentation for NSDistributedNotificationCenter and was able to whip up this quick example in MacRuby.

First, you have to install and use MacRuby. The fastest way to do this is with the fantastic RVM. Simply do rvm install macruby && rvm use macruby. After that you can use the following gist and watch it spit out any and all distributed notifications. Try opening iTunes and switching tracks to see some interesting information.

MacRuby Notification Gist

I hope this quick example is useful and I hope to post more about my MacRuby experience, soon. Stay tuned to see what I'm building!

Read More Recent Posts