Notify-send: tool to display notifications from background tasks in GNOME

Notify-send: tool to display notifications from background tasks in GNOME

Sometimes we’re running build process which can take some time. And you want to get notification once it’s completed but do not want to be starring in console all the time.
GNOME provides a simple tool named notify-send which can be used to show notifications. Just add the following command in the script which runs the build process:
notify-send “OpenJDK” “Build Complete” -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000 ;

And once the build is complete – you’ll see something like:

You can even analyze the exit code of the build process and display different notifications depending if the build is successful or not.
Something like:

ant build-all
if [ $? = “0” ];
then notify-send “OpenJDK” “Build Complete” -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000
else
notify-send “OpenJDK” “Build Failed” -i /usr/share/icons/gnome/scalable/emblems/emblem-important.svg -t 5000
fi

I really like notify-send. Will be using it for all of my Ant/Maven builds.