21

The ordering of shell extension widgets appears to be random, how can I change it? I want to have the date/time information at the left for example.

My shell panel:

My shell panel

  • Good question. I fear it is almost impossible without having to edit strange css files. This is one of the things that shows that the whole extension thing was an afterthought, in my opinion. – Rmano Apr 23 '14 at 20:21
  • Some extensions like extensions.gnome.org/extension/584/taskbar allow you to place where you put it... (might be wrong extension - one of the taskbar extensions...) – Wilf Apr 23 '14 at 20:33
  • I'd love to find an answer for this – That Brazilian Guy May 26 '15 at 17:07
  • @ThatBrazilianGuy Than love the answer :) – A.B. Aug 14 '15 at 9:21
  • @klausi I have updated my answer. I hope it fits your needs :) – Jibbow Aug 14 '15 at 14:00
22

Common way:

To begin with you have to find the according file of the extension you want to change.
You can usually find it here: ~/.local/share/gnome-shell/extensions.
If the extension has been installed via package manager you can find it here: /usr/share/gnome-shell/extensions/(Thanks to A.B.)

Then go into the extension's directory and open "extension.js" with any text editor.

Go to the line with: function enable() (use the search function in your editor - if you can't find it go to the Update section further down).
Inside this function usually is a line Main.panel.addToStatusArea('NAME', _OTHERNAME, NUMBER, LEFT/CENTER/RIGHT); (Again: If you can't find it go to Update). It could happen that the last two parameters (NUMBER and POSITION) are missing; looks like this: Main.panel.addToStatusArea('NAME', _OTHERNAME);
(Don't worry! Your computer interprets the shorter version with: ('NAME', _OTHERNAME, 0, right); Feel free to add the missing parameters. But always in the shown order!!!)

The POSITION defines where on the panel the icon should be. There are three areas: left, center and right. You probably don't want to change this value but feel free to do so. Here are the three possible states for POSITION on the panel:

------------------------------------------------------------------
Activities                 Date                        Other icons
------------------------------------------------------------------
   left                   center                          right 

The more important value you probably want to change is NUMBER. It defines the order of the icons inside the sub-panels. Possible values are:

  • 0: I don't care where the icon is.

  • negative values: position; starting from the right side (could be important as all extension icons are loaded after the system icons)

  • positive values: position; starting from the left side. Higher values will be located further to the right side.

You have to play around with those values in all of your extensions because same values conflict with each other (two different extensions on position 2 doesn't make any sense). And sometimes even following values conflict.

Every time you change the value make sure to save the file. Then hit Alt+F2, type r and Enter. The panel will refresh with the newly ordered icons. This is a fast option to play around with those values.


Lastly a cite from Mathematical Coffee:

Use Main.panel.addToStatusArea(unique_name_of_indicator, inidicator, position, box) to add a SystemStatusButton or PanelButton to the panel. This handles adding its menu to the menu manager for you (box is Main.panel._{left, right, center}Box, omitting the box argument gives right box by default, and ommitting position gives position 0). If your button is a ButtonBox only (i.e. no menu) then stick with. _{left, right, center}Box.insert_child_at_index.

Please let me know if you had any problems with this approach.


Update:

I have looked around and I recognised that this way doesn't work for all extensions (mostly just for simple/new extensions). A frequently used extension in this case is "system monitor". The way of modifying the icons position should be (generally) the same (I haven't tested it. So make sure to create a backup file). But there are some differences for "system monitor":

  1. The function you have to search is called var enable = function (). So it might be better to search for the word enable in the file.
  2. The place where the position of the icons is defined is called Main.panel._addToPanelBox('system-monitor', tray, 1, panel);. Changing the number should have the same effect as desribed above. In order to change the whole area you have two options:

    • By changing the very same line to Main.panel._addToPanelBox('system-monitor', tray, 1, Main.panel._rightBox);(Note: The position in the settings menu of the extension won't work any more).

    • Or by changing the line let panel = Main.panel._rightBox; (again use the search function) to your desired position (_leftBox, _centerBox, _rightBox).

(These steps can be applied to any other extension. But there will be slightly different names. But still: The common way was described in my firt attempt for this answer)


The whole procedure in a nutshell:

Search for the according file. Then search for enable inside this file. Then search for anything like Main.panel... and change the values (quite self-explaining).


And finally I noticed that you mentioned the time panel. I found no good way to modify its position but here is something else:

You have "system monitor" installed. That's good :)
Open the according extension.js and change the word "right" to "left" in those two lines:
Main.panel._addToPanelBox('dateMenu', dateMenu, -1, Main.panel._rightBox); and Main.panel._rightBox.insert_child_at_index(dateMenu.actor, -1);.
Finally you have to check "move clock" in the settings of this extension. There you go! I haven't tested it but it should work. If not, write a comment :)

Ahh! Forgot to mention: Every time you change on of the values save the file and refresh the panel with Alt+F2 - type r - hit Enter. And make sure to create backup files!!! :D

| improve this answer | |
  • If you like the answer, just click the little grey at the left hand side of the answer now turning it into beautiful green. If you like the answer, click on the little grey checkmark and the little up-arrow... If you have any further questions, go to askubuntu.com/questions/ask – A.B. Aug 14 '15 at 9:20
  • Same question; different answer :) – Jibbow Aug 14 '15 at 9:31
  • 2
    Extensions installed via package manager are placed in /usr/share/gnome-shell/extensions/ – A.B. Aug 14 '15 at 9:44
  • 1
    Wow! You should get a few more upvotes just for all the effort! ;-) – Fabby Aug 14 '15 at 19:45
  • 2017 and still impossible without risking your system. Astonishing. – RichieHH Sep 13 '17 at 10:42
2

The Extend Panel Menu extension will let you sort indicators with the "Tray offset" feature and the Indicators tab. After installing the extension, go into the settings to tweak your indicators. Happy OCDing!

| improve this answer | |
  • Not quite what I was looking for but great tip nonetheless. This extension fixes calendar in the middle and grouped status menu that has always bugged me! :) – Cas May 23 '18 at 12:12
-2

There's also an easier way of just opening gnome-tweak-tool, browsing to the Extensions tab, then turning extensions off and on again. Doing this moves the icons to the left.

| improve this answer | |
  • Turning what off and on...? – George Udosen May 27 '17 at 17:57
  • 1
    this will order extensions only for this session. – QkiZ Nov 1 '17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.