How can I order Gnome3 shell extensions at the top?
Solution 1
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":
- The function you have to search is called
var enable = function ()
. So it might be better to search for the wordenable
in the file. -
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
Solution 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!
Related videos on Youtube
klausi
Updated on September 18, 2022Comments
-
klausi over 1 year
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:
-
Rmano about 10 yearsGood 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.
-
Wilf about 10 yearsSome 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...)
-
That Brazilian Guy almost 9 yearsI'd love to find an answer for this
-
A.B. over 8 years@ThatBrazilianGuy Than love the answer :)
-
Jibbow over 8 years@klausi I have updated my answer. I hope it fits your needs :)
-
-
A.B. over 8 yearsIf 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
-
Jibbow over 8 years
-
A.B. over 8 yearsExtensions installed via package manager are placed in
/usr/share/gnome-shell/extensions/
-
Fabby over 8 yearsWow! You should get a few more upvotes just for all the effort! ;-)
-
George Udosen almost 7 yearsTurning what
off
andon
...? -
RichieHH over 6 years2017 and still impossible without risking your system. Astonishing.
-
QkiZ over 6 yearsthis will order extensions only for this session.
-
QkiZ over 6 yearsThe position is changing of system monitor but no matter if values will be positive or negative its always positioned on the right of everything.
-
Cas almost 6 yearsNot 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! :)
-
Muhammad Younus over 3 yearsThats some awesome explanation.Thanks