Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to program a status icon that will display in Ubuntu 11.04 as well as in other distributions?

Hello, I have a small audio recording application programmed with GTK/GDK. (see picture). And I would like to add a tray-icon for it so users can control the application window and recording from it.

Adding a tray icon: I have planned to use the GtkStatusIcon class for this task. Ref:

Is GtkStatusIcon the recommended solution that also works in Ubuntu's Unity and in the GNOME 3.0 desktop? I already googled a bit and found a good example on GtkStatusIcon.

Could I also use Libindicator for this task? Ref:

share|improve this question

marked as duplicate by Marco Ceppi Jun 5 '11 at 20:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

possible duplicates: and – Takkat Jan 3 '11 at 13:00

GtkStatusIcon is not supported in Unity.

If you need an icon displayed use Application Indicators instead. They are quite easy to handle but one drawback is that custom icons are not officially supported yet (see this question here), and that application indicators may not be available in other distributions.

In addition, defining custom icons as suggested here does not work in early versions of Application Indicators used in 10.04 LTS.

Therefore you may need that your program checks if Application Indicators are present, and in addition checks the version they have in order to get them running properly. If Application Indicators are not provided or if your application should also run in other distributions you can also use GtkStatusIcons. In this case you will have to program for both paths as was suggested here.

As far as I can see today GtkStatusIcons will still be supported when running classic GNOME Desktop in Ubuntu 11.04 but I don't know about GNOME3.

share|improve this answer

Thank you for the answer Takkat.

I have now coded the tray icon for my application. It implements both the older GtkStatusIcon class and the new tray icon that uses AppIndicator. The configuration step (before make) checks if the appindicator-0.1 library is present. If it is, then the HAS_APP_INDICATOR variable is defined and set.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.