Backstory
A few days ago, I stumbled across the wonderful world of CoffeeScript. I really wanted to dive right into this wonderful annoying language and felt that the best way to go about it was to make something. I’ve always been a fan of open source widget engines, and wanted to make a widget of my own. This was a great little project for me to kill two birds with one stone.
Übersicht is an open source widget engine built for OSX. What’s great is that it lets you run system commands and display their output on your desktop using CSS HTML5 and CoffeeScript (or JS).
I decided to learn the basics of CoffeeScript syntax by building a small (yet useful) Übersicht widget called, Morning.
What is it?
Morning is a Übersicht widget that displays the time, and greets the current logged in user with a brief salutation. It is a very minimal, which I like.
It is a desktop clone of the popular Google Chrome extension, Momentum.
How can I install it?
First, you’ll need to install Übersicht. Once that’s installed, head on over to the widget gallery and download Morning.
After you’ve unzipped the package, place the morning.widget
directory into your Übersicht widget directory. If needed, open morning.coffee and adjust the .container
margins to position the widget on your screen.
How does it work?
Morning is nothing special. Simply put, it grabs the current time, figures out what part of the day it is and spits out a string. Realizing the date logic was not difficult and fairly easy to code.
The name of the current user is not hard coded, but is found by executing the following command:
'finger 'whoam' | awk -F: '{ print $3 }' | head -n1 | sed 's/^ // '
Since we only need the first name, the output is split and the first element in the array is used. I made sure to comment every section of the code, and have pushed it to GitHub for those who would like to follow along. You can check out the source here
Update
Morning was featured in Lifehacker’s Winter Desktop. Check it out here :)