notify-send

Using notify-send to Slack Off Efficiently

Thursday, December 17th, 2009 | Linux, Programming | No comments

I’ve been working on a big project in MPI and the execution times on my code are annoyingly long (on the order of minutes). I like to keep my work in a separate workspace from my browser to minimize distractions, but then when I set my code running and head over to visit reddit or something I often don’t notice when my code finishes. Today it occurred to me that this would be a good use for libnotify. There is a command-line utility called notify-send (you should have it if you have a recent version of Ubuntu; not sure about other distros) which gives a simple interface to libnotify, so I whipped up a tiny script to call it:

#!/bin/bash
 
EVAL_STRING="notify-send -u normal -t 5000 -i info \"Task completed\" \"$@\""
eval $@; eval $EVAL_STRING

I put it in a folder which is in my path, and now I just do

$ notify ./takes_forever

and I know as soon as it’s done. OK, back to work.

Tags: , ,