Most of the application can show nicely formatted notification on events that appear on top right corner of the screen. I'm about to write a bash script that will do fairy long processing in the background and I really want to know when it is finished. How can I show that nice notification from a bash script?

link|improve this question

68% accept rate
feedback

5 Answers

up vote 19 down vote accepted

If you're using the new notification system in Jaunty, you want the notify-send command

notify-send - a program to send desktop notifications

SYNOPSIS

With notify-send you can sends desktop notifications to the user via
a notification daemon from the command line.  These notifications can be
used to inform the user about an event or display some form of information
without getting in the user's way.

OPTIONS

-u, --urgency=LEVEL
Specifies the urgency level (low, normal, critical).

-t, --expire-time=TIME
    Specifies the timeout in milliseconds at which to expire the notification.
-i, --icon=ICON[,ICON...]
    Specifies an icon filename or stock icon to display.
-c, --category=TYPE[,TYPE...]
    Specifies the notification category.
link|improve this answer
2  
Thanks, just found it myself :) apt-get install libnotify-bin have to be run before to get it. – vava Aug 29 '09 at 10:39
feedback

For KDE users:

$ kdialog --title "Long process completed!" --passivepopup "This popup will disappear in 5 seconds" 5 &
link|improve this answer
Is it possible to set an icon for the notification? – Bruce Connor May 14 at 4:18
feedback

Found another way, through Zenity

echo 'message:hi' | zenity --notification --listen

(This also has the benefit of already being installed on Ubuntu.)

link|improve this answer
feedback

In a shell script, you can also call the osd_cat utility from libxosd.

link|improve this answer
1  
This is a little bit different as it doesn't use ubuntu desktop notifications. – vava Aug 29 '09 at 13:43
Yes, this is an alternative that you can use with any Linux distribution and any WM/DE. – geek Aug 30 '09 at 13:39
feedback

There's also xmessage that will pop-up a window, so it shoud work on any X11 system.

Pro: It also allows interactively prompting the user with buttons.

Con: Like any pop-up alert, it typically receives focus, so if you're in the middle of typing it can disappear before you read the message.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.