Utilising the notification system in KDE or Gnome in bash scripts (ubuntu 9.10 / linux)
So you want to use the nice notification features available in your desktop environment (KDE or Gnome) from a script you wrote? Below explains how to do just that for the two different environments.
KDE
The code below will use kdialog (should be installed along with kde) to create a popup message that displays for 3 seconds before closing:
kdialog --passivepopup 'notification message!' 3
This should look like the image below:
Source: stackoverflow
Gnome
A similar tool is available for gnome, but to the best of my knowledge (I don’t really use gnome) you need to install a package. The libnotify-
sudo apt-get install libnotify-bin
The command notify-send can then be used to create notifications from your script.
notify-send -t 3000 "notification title" "notification text"
Where 3000 is the timeout in milliseconds (so 3 seconds). notify-send features some nice additional options such as the ability to include images eg:
notify-send -i /home/user/exampleicon.png -t 3000 "notification title" "notification text"
Source: Coder’s Talk




