Friday, May 19, 2006

how to write a system tray application?


The system tray is a cross-desktop method of notifying the user. It will be very usefull for user. Suppose if you have mailclient[Kmail] and if it is in system tray then whenever new mail will come, it will pop up a new windows with notification of new mail. But question is how to write these kind of application? Well i was searching internet for document. Yesterday i got one document from redhat site . It is in perl language.Search the document
Procedure:
1.Your system should have perl and gtk 2.0.
2. We need two library called
a)gnome-python2-libegg-2.10.0-2.1
b)gnome-python2-extras-2.10.0-6
Just Download this two rpm and installl with --nodeps option like
suman@>rpm -ivh gnome-python2-extras-2.10.0-6.i386.rpm gnome-python2-libegg-2.10.0-2.1.i386.rpm --nodeps
Open a vi editor with file name test.py
#! /usr/bin/python
import gtk
import egg.trayicon
t = egg.trayicon.TrayIcon("MyFirstTrayIcon")
t.add(gtk.Label("Hello"))
t.show_all()
gtk.main()
Copy this code to the file. And run as suman> python test.py
Thats's all !!! A "Test" system tray icon will be shown in your desktop system tray.

No comments: