How to write an application for the system tray in Linux

user50685 picture user50685 · Jul 30, 2009 · Viewed 10.1k times · Source

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.

Answer

Adam Batkin picture Adam Batkin · Jul 30, 2009

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.