Skip to content

Utilising the notification system in KDE or Gnome in bash scripts (ubuntu 9.10 / linux)

by mat on February 18th, 2010

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.


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:

kdialog passive popup notification

kdialog passive popup notification

Source: stackoverflow


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

  1. Thanks! I just got to make a simple script to notify & then activate the screensaver (for 10s) for every 20m to rest my eyes :)
    I’ll be posting this on my blog

  2. This is awesome! Thanks dude.

Trackbacks & Pingbacks

  1. Ubuntu: Pop-up notifications from shell scripts «

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS