Archive for September 2009

Sep
30
2009

Developing Dashboard widgets with Unimotion

Seismometer Dashboard widget

I recently put the finishing touches on my UnimotionPlugin project. It’s essentially a javascript wrapper around the Unimotion C library, making it good for use in Mac OS X Dashboard widgets.

Unimotion taps into the sudden motion sensor found in Apple’s portables. This sensor reads the orientation and movement of your Macbook, presumably so in the event of you dropping it OS X will do something clever like stop your hard disk spinning to save it from damage. Reading this data opens up some pretty interesting development opportunities

The example widget I made with the software is a fairly unimaginative seismometer but I think there’s a lot more potential.

Developing Dashboard widgets is great fun, you get to use html, css and javascript, plus you know your target browser (it’s Safari) so can use all the latest kit such as the canvas tag. But also, with a bit of mapping between javascript and C libraries can easily take advantage of all the unix environment has to offer, which for me is where the fun comes in. Previously I have used a Dashboard widget to control my Arduino by opening up a socket server talking over USB via javascript, which is kind of cool.

However, from a developers perspective, the Dashboard as an environment does seem limited - if only because it’s a place for very small apps that you’ll use for a very short time. Another interesting avenue to explore would be to write a small Cocoa application that holds an embedded WebKit instance, you could map through to C / Objective-C for all the heavy stuff but build your interface in html and javascript. I’m sure somebody like me, who’s background is in javascript and has had a mare of a time trying out Objective-C would find this useful.