How can I move the workspace switcher popup to the right?

In the 3rd comment in this issue on gitlab you can see pictures describing what I want to archieve.

I searched and tried for hours now, but don’t have much knowledge in js, though I managed it to change the size, the color, transparency etc of that popup (based on this link). But I also would like to move the whole popup to the right and tried things like x = 50; or WorkspaceSwitcherPopup.set_align and also tried a whole bunch of things which I combined from different sources and extensions, but failed.
Since the askubuntu link above uses a custom theme (I edited my Orchis theme [1]) but extensions like Move OSD Windows [2]) move these windows with an extension (instead of a theme/gnome-shell.css editing solution) I’m not sure whether I have to edit my theme or if I have to create an extension for that.
If I create an gnome-shell extension I would have to implement const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup; right? But how do I move this window (to the right) after that?

A hint (like a variable I have to set or what component I have to use) or a tutorial/reference would be great!
I am using GNOME 3.30.2, Debian 10 (Buster) if that’s important.

Thank you!

I got the message: “Sorry, new users can onlyput two links in a post”, so I had to seperate those links and couldn’t implement them above. But still, giving credit is important in my opinion…
[1] https://www.gnome-look.org/p/1357889
[2] https://extensions.gnome.org/extension/1220/move-osd-windows/

Just inject workspaceSwitcherPopup.WorkspaceSwitcherPopup._redisplay() function by this:

let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
let [, containerNatHeight] = this._container.get_preferred_height(global.screen_width);
let [, containerNatWidth] = this._container.get_preferred_width(containerNatHeight);
this._container.x = workArea.x + Math.floor((workArea.width - containerNatWidth) - 50);
this._container.y = workArea.y + Math.floor((workArea.height - containerNatHeight) / 2);

The key is to change the _container.x property, the -50 moves the popup 50 px from the right edge of the primary monitor. If you replace Main.layoutManager.primaryIndex by global.display.get_current_monitor() the popup should appear on the monitor with mouse pointer.

Thank you @GdH !

I actually upgraded to Debian 11 now, since it only seemed to work on greater GNOME versions. I cannot test if it would work on Debian 10, but you helped me to solve a few things with your code.

I released it on Github (and obviously gave you credit for it @GdH)

No problem, thanks for the credit. If you need some more help, I’m here: G-dH · GitHub :wink:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.