Reduce your context switch delay

Sometimes, simple shell scripts can save a lot of time. Recently, I noticed myself waiting for various unit tests to complete by surfing the web: a surefire way to be distracted for more than the time it takes for the tests to complete (or fail). Enter the following script, which I call notify:

#!/bin/sh
"$@"
status=$?
xmessage -center "$(basename $1) done, status $status"
exit $status

You run it like this:

notify make all

at which point make runs along merrily. Of course, you replace make with whatever command you run that takes a long time to complete. When make exits, a small window appears in the middle of your screen that says “make done, status 0″. This immediately notifies you to stop surfing and get back to work.

So… get back to work!

2 Comments

  1. Posted 15 July 2008 at 2:14 pm | Permalink

    /usr/bin/notify-send (available via the libnotify-bin pkg on Ubuntu and presumably other Debian-based distros) is even better than xmessage.

  2. Posted 15 July 2008 at 3:20 pm | Permalink

    Oh, cool, thanks for the tip!

Post a Comment

Your email is never shared. Required fields are marked *

*
*