Is it possible to change the order of icons shown in the indicator applet? With Tomboy indicator, Weather indicator, Clipboard-manager indicator, Ubuntu One and Dropbox indicators and a Battery Status indicator in addition to the classic Messages indicator and Sound Menu indicator my Indicator Applet becomes a little bit messed up, sorting the icons would help a lot...
4 Answers
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!
-
I got the system indicators listed in the first file. But don't have a
~/.local/share/indicators
directory. Help!– charlieMay 14, 2013 at 18:47 -
2This answer is likely outdated, I have no such file in
~/.local
. The file at/usr/share
does not contain entries for all the indicator applications and changing it produced no effects. It would be nice to have an answer for 14.04. Jul 31, 2014 at 6:11 -
1It works with Ubuntu 14.04, you just have to explicitly add every indicator you are using to the file. Run this command to find out which ones you are using:
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" | sed 's/_/-/g' | cut -d"/" -f5
It won't work with Dropbox though, because the status notifier ID changes based on dropbox's PID. I've added an answer below to update the ordering-override.keyfile based on Dropbox's PID.– GruzzlesAug 5, 2014 at 3:55 -
Does this work for 15.04? I've created the file in
.local
, but don't see it working. The original global file in/usr/share
is present, which suggests that it should work. Does the parsing of this file get logged anywhere? Is there a way to debug if anything is going wrong? Jul 12, 2015 at 9:56 -
@ted-gould Can you pinpoint the code in indicator-applet source which makes the order fixed? Jan 23, 2017 at 4:48
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
-
1
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
-
1@James This obviously also applies to application-provided indicators, since Transmission is used as an example.– Léo LamDec 22, 2014 at 14:31
-
Does this work for 15.04? I've created the file in
.local
, but don't see it working. The original global file in/usr/share
is present, which suggests that it should work. Does the parsing of this file get logged anywhere? Is there a way to debug if anything is going wrong? Jul 12, 2015 at 9:55 -
After
kill $(pgrep unity-panel-service)
this does work :-) I have rebooted after creating theordering-override.keyfile
, so I don't know why it "took" after this panel restart. Jul 12, 2015 at 10:21 -
This way of restarting the panel
root@laptop:~# restart unity-panel-service
doesn't work any more:restart: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
Jul 12, 2015 at 10:23
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
-
root@laptop:~# restart unity-panel-service
restart: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
Jul 12, 2015 at 10:16