Stay Productive with Growl Notifications

Posted by: Ben Ellingson on 02/20/2011
Being a productive programmer... you would never browse Twitter, Facebook, Digg, or Hacker News while working. You are focused and on task!

Unless, perhaps your full app build or other common task require a few minutes or more of processing? In order to not waste precious time, I often develop with 2 machines... Or.. I will waste precious time and catch up on my tweets. One link leads to another, next thing you know... there goes ten or fifteen minutes while waiting on a 2-3 minute build.

Solution: Add a Growl Notification to Your Build


Growl notifications are a non-intrusive way to let you know your build is complete. Setting this up for a Mac is really easy. I just copy the sample AppleScript, change the notification text, and modify my build to execute the script. I don't need to make this work on Windows, but I imagine that would be pretty easy to do via another method.

Growl was already installed on my system, but you may need to install it yourself.

Apple Script Copied from Growl.info



http://growl.info/documentation/applescript-support.php



tell application "GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Test Notification" , "Another Test Notification"}

-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the growl prefpane.
set the enabledNotificationsList to ¬
{"Test Notification"}

-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application "Growl AppleScript Sample" ¬
all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Script Editor"

-- Send a Notification...
notify with name "Test Notification" ¬
title "Build Complete" ¬
description "NFJS Build Complete" ¬
application name "Growl AppleScript Sample"

notify with name "Another Test Notification" ¬
title "Another Test Notification :) " ¬
description "Alas — you won't see me until you enable me..." ¬
application name "Growl AppleScript Sample"

end tell




Execute the Script from Your Build



I'm using a gant based build, so executing the script is pretty simple.




"osascript bin/build_notify.scpt".execute()




Congrats, now you'll be privy to fewer breaking stories about the next iPhone and such; but you will get more done!

About Ben Ellingson

Ben Ellingson

Ben Ellingson is a software engineer, web developer, and consultant. He is the creator of nofluffjuststuff.com, uberconf.com, and related NFJS websites. He has 13 years of development experience, is an active member of the Boulder Java Users Group and the No Fluff Just Stuff community. He spent his early career at EDS and IBM; then developed a content management system for nCube, a pioneer in the Video On Demand space. He is a multi-talented developer; proficient coding on the server-side, front-end, and mobile applications. His latest creation is the iPad app for Über Conf. Ben lives in Boulder, Colorado. He is an avid runner, who has nearly completed his goal to run the world's 5 major marathons. You can keep up with Ben's work at benellingson.blogspot.com.

More About Ben »

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 7
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 3
  • Automation Tools: Git, Hudson, Sonar
  • HTML5, Ajax, jQuery, Usability
  • Mobile Applications - iPhone and Android
  • More...
Learn More »

NFJS, the Magazine

May Issue Now Available
  • Client-Side MVC with Spine.js, Part 1

    by Craig Walls
  • On Prototypal Inheritance, Part 2

    by Raju Gandhi
  • Making use of Scala Lazy Collections

    by Venkat Subramaniam
  • Integration Testing Web Applications Using Gradle

    by Kenneth Kousen
Learn More »