Reordering Indicators in Ubuntu

Now that the GNOME panel is dead (long live the panel), the next best option for displaying system information in the upper menu bar is Ubuntu’s Indicators. Indicators are a much less powerful system than the old panel once was, due to various tradeoffs of complexity for ease-of-use. One limitation is that indicators seem to appear in a random, arbitrary order. I’d prefer to arrange the indicators myself. For instance I’d like to have all my system monitors grouped together.

It turns out there is a way to reorder the icons, but it’s tricky. These instructions assume you know how the command line works and can read a process list without getting worried. Until the Ubuntu developers add the ability to reorder indicators this is the only way to do it. This page gave me a good head-start. You have to start by creating a special “override” file that will tell the indicator applet how to reorder the icons. Start by creating the override file with the system defaults:

mkdir -p ~/.local/share/indicators/application
cp /usr/share/indicator-application/ordering-override.keyfile ~/.local/share/indicators/application/
gedit ~/.local/share/indicators/application/ordering-override.keyfile &

My default file looked like this:
[Ordering Index Overrides]

The next step is tricky: You’ll need to add each indicator to the file and assign it a number (lower numbers are further to the right), but what do youo call each item? In many cases (but not all), the name is the same as the executable. indicator-cpufreq is just indicator-cpufreq. Run this command to list all the indicators running on your system:

ps xa |grep indicator-

Other applications, like Tomboy, set up their own indicator name. We need a way of finding out what that name is.

The only way I know of to find this name is to rerun the indicator service and read through the debugging output. Yeah, I know. Warning, this process may mess up the display of your indicators. Nothing done here is permanent, so you can always log out and log back in to restore your regular desktop.

Try this:
killall indicator-application-service && /usr/lib/indicator-application/indicator-application-service

Much text will start spewing. If the command prompt comes back right away and you see the following text, just try the command I gave you again:

(process:7601): libindicator-WARNING **: Name request failed.
(process:7601): indicator-application-service-DEBUG: Service disconnected
(process:7601): indicator-application-service-DEBUG: Application proxy destroyed '(null)'
(process:7601): indicator-application-service-DEBUG: Application free '(null)'

Look for lines like this:
(process:7672): indicator-application-service-DEBUG: 'bluetooth-manager' ordering index is '20626C75'

This tells you two things: bluetooth-manager is the name of this particular indicator, and that’s what you’ll want to put in your override file. Also, 20626C75 is the current ordering index. Because it’s a long number, this value is not currently being overridden.

Now we want to make some changes.

Edit your override file. Here’s mine:
[Ordering Index Overrides]

The rerun the command I gave you. You should see some changes:

(process:7672): indicator-application-service-DEBUG: 'indicator-sensors' ordering index is '9'

This means that I successfully assigned the ordering value of 9 to indicator-sensors. And indeed, all my indicators are in the order I want.

When everything is how you want it, log out and log back in to make sure the changes worked.

update 10/19/2012:

there’s a better way to list running indicators:
dbus-send --type=method_call --print-reply \
--dest=com.canonical.indicator.application \
/com/canonical/indicator/application/service \
com.canonical.indicator.application.service.GetApplications | grep "object path"

This will print out the running indicators. replace underscores with hyphens in the keyfile