Difference between revisions of "Desktop notifications"
(incorrect use of translation template; remove introduction heading)
m (Bot: Removing from Category:HOWTOs (English))
|Line 1:||Line 1:|
Revision as of 17:51, 10 June 2011
Libnotify is an easy way to display desktop notifications and information in a small dialog. It's used in much opensource apps like Evolution, Pidgin, etc. It has support for Gtk+ and Qt applications and is desktop independent.
The libnotify package is available from the Extra repository. Install libnotify from a terminal with the following command.
pacman -S libnotify
To configure libnotify in Gnome install the packages notification-daemon and gconf-editor available in the Extra repository.To install the packages from the terminal:
pacman -S notification-daemon gconf-editor
Open gconf-editor from the terminal with the following:
From gconf-editor, select "/apps/notification-daemon/" from the sidebar which will allow libnotify to be configured.
To configure libnotify in XFCE, you need the packages xfce4-notifyd and xfconf available in the Extra repository.To install the packages from the terminal:
pacman -S xfce4-notifyd pacman -S xfconf
To configure linotify, run the following command in the terminal:
Tips & Tricks
You can write your own libnotify display messages easily in Python or other languages. Here is a simple Python example.
Note you will need to install the Python bindings for libnotify
pacman -S python-notify #(communitiy)
Hello world example
#!/usr/bin/env python import subprocess info = "Hello world " subprocess.call(('notify-send',info))
#!/usr/bin/python import subprocess import commands #KERNEL VERSION uname = commands.getoutput('uname -r') head = "All the info about your system:" msg = "Your kernel version: "+ uname +"\n" # print message subprocess.call(['notify-send', head, msg])
Or you can just use bash
# send a notification saying hello world notify-send "hello world"