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.


Cycling London to Brighton

Today I road my new super cheap bike down to Brighton from London (*), blissfully unaware of the 27,000 other cyclists riding down on an alternative route with the annual British Heart Foundation cycle ride. It only became apparent that I may be in trouble when I arrived at a seafront full of bikes and the news that no trains were accepting bikes as passengers! Luckily I managed to get on one of the BHF’s buses back to Clapham, they even brought my bike along in a huge lorry too!

I’ve plotted my route on Bikely, it’s a nice ride taking you over Biggin Hill and then on through Ashdown Forest, home of Winnie the Pooh. There’s some really quaint stops along the way, particualy the villages of Westerham and Hartfield.

The profile of the route show’s it’s fairly hilly. I’m not sure how this compares with the usual London to Brighton route the other guys had done but the last 15 miles or so were pretty tough. Next time I think I’ll have to grab a better breakfast before hand!

(*) I know, not strictly a “Programming & Tech” related post, but the GPS tracking helps. All the same, maybe I should find a better name for this blog.


Growl + Atom = Constant Badgering

I’ve finally cottoned on to the Growl app on OSX, a nice little notification system that allows applications to ‘unintrusively tell you when things happen’. Looking into it a little I realised I could couple Growl with a few atom feeds and enable myself to be notified to events such as a new email coming into Gmail or our project’s build failing on Hudson. Introducing growl-atom :

A failed build and less than useful email

Whether this is a good idea or not is questionable. Entourage - which I use at work - fires a little notification with every new email I receive. This can get more than a little annoying when the Friday afternoon ‘name my hamster’ type discussions kick off. Never the less after a few fun hours coding I have a nice little system that will tell me when (hopefully) important stuff happens.

The code is up on Github if anybody wants to install it. It’s a simple Ruby gem (thanks to visionmedia for the ruby-growl gem), combined with a config file and Apple’s answer to the cron job which is something called a LaunchAgent. Check it out!

Visit the growl-atom page on Github