ARTICLE

Application Indicators In Python

by | Thu 17 Dec 2009

I am really excited to see [Ted’s post](https://gould.cx/ted/blog/Having_a_tidy_systray) regarding some of the improvements coming to the desktop notification area. This part of our desktop has become something of a wild west – icons look ugly, are spaced too close together, have left/right click inconstancy, often provide obscure and inaccessible widgets and cannot be easily controlled across notification icons with a single keyboard shortcut. This approach will fix many of these issues.

This approach has two distinctive components – the user interface improvements and the technology to implement. The user interface changes I think are really interesting and bring some distinctive benefits:

* Application indicators are more consistent – no more left and right-click inconsistency. Always left click to see the items.
* Scrubbing – you can click once on an app indicator and scrub left and right through other indicators with your mouse.
* More accessible – importantly, scrubbing also applies to the keyboard: this means you could bind a key to the indicator applet, hit that key and then use the arrow keys to navigate through all the indicators.
* Themable panel icons – you can set a specific icon to be a panel icon for an indicator: this should make it easier for creating single colour panel icons for light and dark themes.
* KDE/GNOME compatability – one thing that really excites me is that by using this spec, KDE applications running in GNOME will have their application notification menus rendered with GTK widgets and vice-versa.

I am really excited about the opportunities this brings to the desktop, and I am also really excited about us working with our friends in KDE on this spec.

I wanted to give this a roll in my more native Python tongue so I [added the Karmic PPA](https://edge.launchpad.net/~indicator-applet-developers/+archive/indicator-core-ppa) and started playing with the module. I contributed my code as an example [on the wiki](https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators). Here it is to show how it works:

import gobject
import gtk
import appindicator

if __name__ == “__main__”:
ind = appindicator.Indicator (“example-simple-client”, “indicator-messages”, appindicator.CATEGORY_APPLICATION_STATUS)
ind.set_status (appindicator.STATUS_ACTIVE)
ind.set_attention_icon (“indicator-messages-new”)

# create a menu
menu = gtk.Menu()

# create some labels
for i in range(3):
buf = “Test-undermenu – %d” % i

menu_items = gtk.MenuItem(buf)

menu.append(menu_items)

# this is where you would connect your menu item up with a function:

# menu_items.connect(“activate”, self.menuitem_response, buf)

# show the items
menu_items.show()

ind.set_menu(menu)

gtk.main()

I basically created an indicator object and threw a GTK menu into it and as if by magic my app appeared in the notification panel, properly spaced out and enjoying the benefits I mentioned above. Pretty simple. 🙂

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,...