I recently noticed that in ubuntu unity the application indicator (which replaces the system tray) does not show the custom icons I added to the gtk stock, but only the basic stock icons. In place of the correct icons I see "gtk-missing-image". On my apps toolbars and menus those icons are displayed properly, the problem is only with the top application indicator. I use gtk ui manager after integrating the stock icons this way:

factory = gtk.IconFactory()
pixbuf = gtk.gdk.pixbuf_new_from_file(filepath)
iconset = gtk.IconSet(pixbuf)
factory.add(stock_name, iconset)

then the appindicator code:

    import appindicator
except: HAS_APPINDICATOR = False
        self.ind = appindicator.Indicator("x-tile", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS)
        self.status_icon = gtk.StatusIcon()
        self.status_icon.set_from_stock("Tile Quad")
        self.status_icon.connect('button-press-event', self.on_mouse_button_clicked_systray)
        self.status_icon.set_tooltip(_("Tile the Windows Upon your X Desktop"))

for full code:

hg clone https://giuspen-x-tile.googlecode.com/hg/ hg_x-tile
cd hg_x-tile
hg up x-tile2

The icons are visible when using system tray, not with application indicator If anybody solved this problem please help.

1 Answer 1


It is not possible to use stock icons created on-the-fly in appindicators.

When using statusicons, your application is in full charge of building and displaying the menu. However, when using appindicators, what happens under-the-hood is that your application just makes a request and who really builds and displays the menu is a service running in the background.

This service is a independent program, completely separated from yours. Therefore it is not aware of things such as environment variables and stock icon names that you created on-the-fly.

The best workaround is using the set_icon_theme_path of the indicator to tell it where the icon is. You don't even need to change the stock in this case.

  • would it be possible to continue using gtk ui manager with your workaround? could you post a couple of lines of code to describe the workaround? thanks.
    – giuspen
    Jan 13, 2012 at 23:54
  • 1
    Ugh, sorry for the delay, I thought AU would notify me of comments via email and it didn't... -_- Let's say your icon is "/home/giuspen/myicons/theicon.png". Then what you need to do is "self.ind.set_icon_theme_path('/home/giuspen/myicons')". After doing that, "self.ind.set_icon('theicon')" should work. Jan 20, 2012 at 18:35
  • ok it's just important that the new stock icons name is exactly the name of the icons files without the extension
    – giuspen
    Sep 11, 2012 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .