nlpsuge / gnome-shell-extension-another-window-session-manager

A Gnome shell extension to close open windows gracefully and save them as a session. The previous session can be restored at startup. Most importantly, it supports both X11 and Wayland!
https://extensions.gnome.org/extension/4709/another-window-session-manager/
GNU General Public License v3.0
141 stars 8 forks source link

Problem in multi-monitor mode with two horizontal rows of screens #63

Closed victor-lipin closed 1 year ago

victor-lipin commented 1 year ago

Hello! There is a problem with moving windows to the top row of monitors (monitor 1 in the screenshot)

As far as I understand, this is due to the fact that the origin point for windows "x_offset": 0, "y_offset": 0, is the upper left corner of monitor 2.

I can move windows horizontally using "x_offset" in the config file. But I can't raise the window vertically because "y_offset": 0 this is the highest point of the monitors 2 and 3.

Perhaps using negative "y_offset" values could help, but it didn't work for me.

Screenshot from 2022-11-15 18-35-51

victor-lipin commented 1 year ago

I use Manjaro Linux 22.0.0 with GNOME Shell 42.5

nlpsuge commented 1 year ago

What is the x_offset, y_offset of the app in the monitor 1? Please show me the window_position part in the session file related to this app.

Can you move the app from monitor 2 to monitor 1 by hand?

victor-lipin commented 1 year ago

What is the x_offset, y_offset of the app in the monitor 1?

"x_offset": 1777, "y_offset": 24

The parameters look correct, but when the window is restored, it falls on the 3rd monitor. As if y_offset is not on monitor 1 but on monitor 2.

Put Gedit on 1 monitor in the upper left corner and saved the settings Screenshot from 2022-11-16 21-52-55

Restored the Gedit window and it fell on the 3rd monitor Screenshot from 2022-11-16 21-54-11

Can you move the app from monitor 2 to monitor 1 by hand?

No, i can move app only from 3 monitor.

But I tested on two monitors

Put Gedit on 1 monitor in the upper left corner and saved the settings Screenshot from 2022-11-16 21-36-58

Restored the Gedit window and it fell on the second monitor Screenshot from 2022-11-16 21-38-38

nlpsuge commented 1 year ago

Looks somehow the app just falls on the primary monitor.

I'm not sure why, but we probably can find some clue in the logs.

First, please enable the Debugging mode in the extension Settings: image

Second, watch the logs in the terminal via journalctl -o short-precise -r /usr/bin/{gjs,gjs-console,gnome-shell} .

Third, reproduce the above steps again and there should be some logs, like Moving gedit - a title to the primary monitor x from y.

Please attach those logs.

I don't even have a physical monitor, I can't test this issue properly. :(


Related code: https://github.com/nlpsuge/gnome-shell-extension-another-window-session-manager/blob/0c19c020cbb5353a53ecdc69ed966807eb93ecfa/moveSession.js#L114-L177

nlpsuge commented 1 year ago

This is a bug, tested with another virtual screen.

Related code: https://github.com/nlpsuge/gnome-shell-extension-another-window-session-manager/blob/0c19c020cbb5353a53ecdc69ed966807eb93ecfa/moveSession.js#L81-L82

L81 does move the window to the monitor that it's supposed to be in. But L82 moves it to the primary monitor while L82 restores the size and geometry using metaWindow.move_resize_frame .

I'll fix it later.

nlpsuge commented 1 year ago

@RebelSon84 Hi, did you have this issue on the older GNOME Shells?

nlpsuge commented 1 year ago

This issue had been committed to https://gitlab.gnome.org/GNOME/mutter/-/issues/2340 4 months ago.

victor-lipin commented 1 year ago

did you have this issue on the older GNOME Shells? Hello! I'll check it out. But I didn't seem to notice it before.

nlpsuge commented 1 year ago

Looks like it's a bug of mutter and I have reported it: https://gitlab.gnome.org/GNOME/mutter/-/issues/2521

nlpsuge commented 1 year ago

@RebelSon84

Hi, could you please test this branch https://github.com/nlpsuge/gnome-shell-extension-another-window-session-manager/compare/bugfix-multi-monitor?

You can download it from the release page: https://github.com/nlpsuge/gnome-shell-extension-another-window-session-manager/releases/tag/29.1

After downloading, copy the contents to extension folder: cp -rp gnome-shell-extension-another-window-session-manager-29.1/* ~/.local/share/gnome-shell/extensions/another-window-session-manager@gmail.com/

Then restart gnome shell (using alt+f2 type r for X11 or logout and login for Wayland).

victor-lipin commented 1 year ago

Hi, could you please test this branch

Hello! Everything works great! Thank you very much