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

I'm trying to create a simple application indicator that mimics the CPU load applet for the gnome-panel.

I currently do this by updating (overwriting) the status icon of the indicator with the new CPU load information and re-set the status icon to the same icon on every update (I know this is stupid, but I don't know if it's currently possible to solve otherwise).

Unfortunately this doesn't work and I always see the "first" icon state, eg.

The indicator icon doesn't update, while the icon's content does.

I also tried to temporarily set the status icon to something else first, eg.


but that didn't work either.

Any ideas?


It is indeed possible to do what I wanted using a hack to cause the indicator to repaint its icon (thanks to Jorge Castro and Ted Gould):


The attention state icon should be the same as the active state icon, else there would be some flicker.

share|improve this question
up vote 4 down vote accepted

This is indeed not the intended behaviour of Application Indicators: they're meant to have one or two icons and not something that you could almost put in a widget.

There seems to be something wrong in the caching of the icon, as it should update a changed icon, though.

Anyway, you probably want to use something like 'libindicator' to create your own, custom indicator. The collection of application indicators on your panel is drawn by one indicator. You have a lot more functions at your disposal when writing a custom indicator, than when using the limited API of Application Indicators, which was limited deliberately to make sure we don't get a mess.

Also make sure to look at the package 'libindicator-tools', which contains some handy utilities for testing indicators.

share|improve this answer
While it is possible to do what I want (see update in the question), I agree that writing a custom indicator probably is a better idea. – htorque Nov 11 '10 at 17:07
Still, I don't see why using an established and well functioning procedure such as GTkStatusIcon is obviously discouraged here. To put this clear again: at present there is full support for GtkStatusIcon in all major desktop managers. Therefore GtkStatusIcon needs to be continued in future releases of Ubuntu, and it will - at least as fallback. Whoever downvoted for GtKStatusIcon could you please explain why you think different. Are there any reasons I might not be aware of to not write programs that depend on GtkStatusIcon? – Takkat Nov 11 '10 at 18:16
The next version of Ubuntu, which will use Unity as the default shell, will not support GtkStatusIcons, apart for Java and Wine special cases. This is done so the desktop can move forwards, using new technology and reduce clutter in the notification area. – Sense Hofstede Nov 12 '10 at 19:18
thank you for pointing at this. Does this really mean that all applications that either need a customizable icon or that rely on a legacy NA will not run in future Ubuntu versions if their developers won't port it? – Takkat Nov 13 '10 at 6:29
They will run on Ubuntu, but their GtkStatusIcon will not be shown. – Sense Hofstede Mar 9 '11 at 15:03

I don't think this is possible and looks like it's by design, from the bug report.

What we instead would like to encourage is for people to start thinking like icon themes. The reason for this is that it allows for multiple sizes and theming of the panel separate from applications. So, for instance, an application could be themed with a light background (thus needing dark icons) and the panel could have a dark background (needing light icons). The application shouldn't have to know about this. And by using icon naming this problem is solvable on the panel side of things.

For the Natty cycle we also want to provide a convenience API to provide for building a custom icon theme for people who want to generate icons. This doesn't solve all of the theming problems, but it does make it possible to solve the multiple sizes one.

Update: To answer your comment Ted thinks that is a bug and recommends that you file a bug on indicator-application, something along the lines of "theme updates are not realized by the indicators"

share|improve this answer
I'm pretty sure that what I do is against the design, but I'm afraid that comment doesn't answer why I cannot edit/alter an icon (within the theme), and force the indicator to update its content. I can do something like indicator.set_icon("a") indicator.set_icon("b") indicator.set_icon("c") ... but I don't have infinite space for infinite new icons. :P – htorque Nov 11 '10 at 14:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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