views:

1259

answers:

4

How do I write my application so it'll live in the system tray on Linux? In fact, just like CheckGmail.

As with CheckGmail, I'd also like some sort of popup box to appear when I hover the tray icon.

Is there an API, class or something for doing this? All I'm able to find seems to be for Windows.

If I have to be language specific, then preferably in C/C++ but a solution in Python will most likely also do.

Thanks.

+6  A: 

This might help:

http://standards.freedesktop.org/systemtray-spec/systemtray-spec-latest.html

Mike Mu
Would be better if you could provide a little more context. What is freedesktop and where is it relevant.
Dave Hillier
+6  A: 

python-eggtrayicon

here's the example that comes with the debian package python-eggtrayicon in debian/testing...

#!/usr/bin/python
import pygtk
pygtk.require("2.0")
import gtk
import egg.trayicon
t = egg.trayicon.TrayIcon("MyFirstTrayIcon")
t.add(gtk.Label("Hello"))
t.show_all()
gtk.main()

It just shows a label in the notification area . (Search on that, and you'll probably get much better hits...)

Anders Eurenius
+3  A: 

Qt is cross platform and has support for the system tray. Its Python bindings are pretty good as well. See the example application for further details.

Kaleb Pederson
+11  A: 

The Qt framework contains a QSystemTrayIcon class. This means that you can write an application in C++ or Python (or any other language with Qt bindings, including C#, Ada, Pascal, Perl, PHP and Ruby) and run your application on Windows, Linux, Mac or any other supported Qt operating system. I should add that Qt applications generally do a pretty good job of looking native on whatever operating system you are using without very much effort (even between Gnome/KDE on Linux). Qt also has excellent documentation, lots of sample code, a generous license and is well-maintained.

Adam Batkin
Thank you. I have decided upon Qt. Great framework.
anderstornvig