Something we have been spending some time working on in this cycle has been fixing the mess that is the system tray. This is based upon an awesome specification submitted to Freedesktop by KDE. The spec has been implemented by KDE, we have written an implementation for the GNOME panel and it will ship in Ubuntu 10.04 Lucid Lynx Alpha 2. We have also started adding application indicator support to many of the applications we ship in Ubuntu, and of course these patches are going upstream as they are written. I would to encourage GNOMErs to join the discussion on the XDG list regarding the spec.
I think the Application Indicator framework rocks. It solves a problem that has niggled me for years: with it system tray applets now have a consistent UI in terms of spacing, a unified left click to access the menu (no more confusing different left/right menus in different apps), you can scrub between icons, KDE applications render their application indicator menus in GNOME as GTK menus and vice versa and the whole shebang is a lot more accessible.
The Application Indicator team have produced C, Mono and Python bindings and documented it all on this wiki page. I wanted to have a play with it with Python so I knocked together a simple little script that demos how it works:
#!/usr/bin/env python # # [SNIPPET_NAME: Create an Application Indicator] # [SNIPPET_CATEGORIES: Application Indicator] # [SNIPPET_DESCRIPTION: How to create an application indicator and add items to it] # [SNIPPET_AUTHOR: Jono Bacon <email@example.com>] # [SNIPPET_LICENSE: GPL] import pygtk pygtk.require('2.0') import gtk import appindicator class AppIndicatorExample: def __init__(self): self.ind = appindicator.Indicator ("example-simple-client", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS) self.ind.set_status (appindicator.STATUS_ACTIVE) self.ind.set_attention_icon ("indicator-messages-new") self.ind.set_icon("distributor-logo") # create a menu self.menu = gtk.Menu() # create items for the menu - labels, checkboxes, radio buttons and images are supported: item = gtk.MenuItem("Regular Menu Item") self.menu.append(item) check = gtk.CheckMenuItem("Check Menu Item") self.menu.append(check) radio = gtk.RadioMenuItem(None, "Radio Menu Item") self.menu.append(radio) image = gtk.ImageMenuItem(gtk.STOCK_QUIT) image.connect("activate", self.quit) self.menu.append(image) self.menu.show() self.ind.set_menu(self.menu) def quit(self, widget, data=None): gtk.main_quit() def main(): gtk.main() return 0 if __name__ == "__main__": indicator = AppIndicatorExample() main()
To make this as helpful as possible for people I have added it to python-snippets which you can of course enjoy using my little Acire tool that I blogged about recently. If you want to give it a go, I recommend you use it with another app that uses Application Indicators, and then you can play with scrubbing between icons and using the arrows on your keyboard to move around. It is pretty awesome.
To continue playing with it I thought I would have a go at writing an application indicator plugin for the always awesome Getting Things GNOME. I only had time spend an hour or so on it last night, but my work in progress is available in this branch. Most of it is complete, but what I am missing from the framework is a signal when a user clicks on the indicator icon: I need this to re-generate the dynamic list of tasks in that menu. I spoke to Ted Gould about it and he said this is likely to be added in the future. When it is ready I will propose it to upstream GTG for inclusion. 🙂