ARTICLE

Application Indicators Rocking The House

by | Thu 14 Jan 2010

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](https://www.notmart.org/misc/statusnotifieritem/index.html). 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](https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators). 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 ]
# [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](https://code.launchpad.net/python-snippets) which you can of course enjoy using my little [Acire](https://archivedblog.jonobacon.com/2010/01/12/acire-0-2-released/) 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](https://gtg.fritalk.com/). I only had time spend an hour or so on it last night, but my work in progress is available in [this branch](https://code.launchpad.net/~jonobacon/gtg/application-indicator-plugin). 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. 🙂

An invitation-only accelerator that develops industry-leading community engagement and growth via personalized training, coaching, and accountability...all tailored to your company's needs.

Want to read some more?

Happy Holidays

Happy Holidays

Just a quick note to wish all of you a happy, restful, and peaceful holidays, however and whoever you spend it with. Take care, folks, and I look forward to seeing you in 2015!

The Impact of One Person

The Impact of One Person

I am 35 years old and *people* never cease to surprise me. My trip home from Los Angeles today was a good example of this. It was a tortuous affair that should have been a quick hop from LA to Oakland, popping on BArt, and then getting home for a cup of tea and an...

Feedback Requested: Great Examples of Community

Feedback Requested: Great Examples of Community

Folks, I need to ask for some help. Like many, I have some go-to examples of great communities. This includes Wikipedia, OpenStreetmap, Ubuntu, Debian, Linux, and others. Many of these are software related, many of them are Open Source. I would like to ask your...

Ubuntu Governance Reboot: Five Proposals

Ubuntu Governance Reboot: Five Proposals

Sorry, this is *long*, but hang in there. A little while back I wrote [a blog post](https://archivedblog.jonobacon.com/2014/11/14/ubuntu-governance-reboot/) that seemed to inspire some people and ruffle the feathers of some others. It was designed as a...

Ubuntu Governance: Reboot?

Ubuntu Governance: Reboot?

For many years Ubuntu has had a comprehensive governance structure. At the top of the tree are the Community Council (community policy) and the Technical Board (technical policy). Below those boards are sub-councils such as the IRC, Forum, and LoCo councils, and...

Dealing With Disrespect: The Video

Dealing With Disrespect: The Video

A while back I wrote and released a free e-book called [Dealing With Disrespect](https://www.dealingwithdisrespect.com/). It is a book that provides a short, simple to read, free guide for handling personalized, mean-spirited, disrespectful, and in some cases,...