How to sort the indicators [duplicate]

The system indicators are in a fixed order by design. While you might not like the order, it makes support easier by having a fixed order (we can argue about the order endlessly). The application indicators work a little bit differently, they're designed so that there is a default order but applications can adjust that for continuity. For instance, if an application had two indicators that it wanted next to each other.

Because this system leads to a possible abuse by application developers there is a set of overrides in the system. The first is at the system level so that it can be managed by packages once the distro figures out there is an abusing application it can be fixed for all users. It's located at:

   /usr/share/indicator-application/ordering-override.keyfile

You can put any status notifier ID in there and give it a new ordering index that will because the new index for that application. There is also a per-user override file that can exist in your home directory at:

  ~/.local/share/indicators/application/ordering-override.keyfile

Hopefully that will give you some help in adjusting your panel the way that you prefer!


The official ubuntu ones (weather, ubu-one, battery, messages, me, sound, shutdown) are hardcoded in place. Sucks. The other ones should take their order using the law of first come first serve, right-left precedence. Judging from this brainstorm/feature request, the answer is: No, you cannot manually change the order of icons via the gui. But see @Ted Gould's answer.

  • Bug report on the issue

To change Application Indicators position on the Unity panel, you must edit a file called ordering-override.keyfile which is located under /usr/share/indicator-application. Since editing this file will change the settings for all users, you can copy it to ~/.local/share/indicators/application/ordering-override.keyfile and make the changes for your user only:

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

Now open the file by running the following command in a terminal:

gedit ~/.local/share/indicators/application/ordering-override.keyfile

In this file you should see the existing rules for Application Indicators order on the panel. The first one is nm-applet and has a value of "1", meaning it will be the first Application Indicator to be displayed on the panel, from right to left.

Using this as an example, you can add your own Application Indicators and specify their position by entering their name and a number like transmission=6 which will make the Transmission Application Indicator to show up as the 6th indicator on the panel (from right to left), if the other 5 indicators exist.

Source: http://www.webupd8.org/2011/06/how-to-change-application-indicators.html

Now, in your case, ordering-override.keyfile file should look like this:

[Ordering Index Overrides]
nm-applet=1
My_Weather_Indicator=2
lang_indicator=3
bluetooth_manager=4
indicator_sysmonitor=5
transmission=6

Instructions to Enable sorting the Dropbox Indicator

Follow Ted Gould's instructions then if you would like to sort the Dropbox indicator, here are a few more steps:

Note: If you edited the file in /usr/share/... then you will have to put the script in /etc/rc.local (look for Note below)

Because Dropbox appends the PID to the indicator name, and this changes every time Dropbox starts, you need to update the ordering-override.keyfile every time dropbox starts.

To do this, you can open a text editor, copy and paste the following script, and name it something like start-dropbox.sh. Then either right click, select "properties", go to the "permissions" tab, and check the "allow executing file as program" box, or open a terminal, navigate to the folder you put the script in, and run run sudo chmod 755 ./start-dropbox.sh

#!/bin/bash
#Disclaimer: This script is intended for use with Ubuntu 14.04. You alone are responsible any consequence resulting from its use.
#The purpose of this script is to start dropbox, update the keyfile, and restart the indicator panel.

#Start dropbox if not already started (for some reason pgrep didn't work)
[[ $(ps aux | grep dropbox | grep dist | awk '{print $2 }') = "" ]] && dropbox start -i

#If the override file exists
if [[ -e ~/.local/share/indicators/application/ordering-override.keyfile ]]
then
    while [ "$(ps aux | grep dropbox | grep dist | awk '{print $2 }')" = "" ]; do
        sleep 1s
    done
    sleep 5s #dropbox creates several PIDs, so wait a bit before continuing
    sed -e "s/dropbox-client-.*=/dropbox-client-$(ps aux | grep dropbox | grep dist | awk '{print $2 }')=/g" -i ~/.local/share/indicators/application/ordering-override.keyfile
    restart unity-panel-service
fi

Now you can open "Startup Applications, and make a new entry, using the full path to your script as the "command" (using ~/start-dropbox.sh won't work, you have to do /home/yourname/start-dropbox.sh).

**Note: This is where you'd add the full script path to the end of /etc/rc.local

One optional step is to open the Dropbox settings and uncheck "Start dropbox on system startup". You can't just change the command for Dropbox that is already in the Startup Applications list, because Dropbox overwrites this every time it starts.

You're done!

Here's what my ~/.local/share/indicators/application/ordering-override.keyfile looks like:

[Ordering Index Overrides]
multiload=13
My-Weather-Indicator=12
redshift=11
Diodon=10
Chars=9
indicator-brightness=8
dropbox-client-24651=7
nm-applet=6
gnome-power-manager=5
ibus=4
gst-keyboard-xkb=3
gsd-keyboard-xkb=2
chrome-app-indicator-1=1