khimaros / smart-auto-move

Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports Wayland.
https://extensions.gnome.org/extension/4736/smart-auto-move/
GNU General Public License v3.0
79 stars 4 forks source link

switching from multi-monitor to single-monitor makes windows immovable #43

Open FriederRodewald opened 11 months ago

FriederRodewald commented 11 months ago

First of, thank you so much for this extension - I really enjoy it! The only issue I encountered is that it seems to have problems in multi-screen setups, i.e., when powering off a system with one monitor attached to a laptop and rebooting without this external monitor, several screen-glitches occur. These seem to differ, with sometimes windows being immovable and other times constantly 'sliding/switching' between or within workspaces. The result is that the system becomes unusable and it is sometimes even hard to turn off the extension, as there is constant movement. After turning off the extension, however, the system continues to work like expected. It does seem to make a difference whether I unplug the external monitor before shutting down the system. Unfortunately, I cannot test the issue with another laptop/monitor setup.

I am using Fedora 38 with Wayland on my laptop which I is often connected to a second monitor.

khimaros commented 11 months ago

thank you for the report. this may be related to https://github.com/khimaros/smart-auto-move/issues/31

does the issue remain after the monitor has been plugged back in? have you found a way to correct the issue other than resetting the extension state entirely?

FriederRodewald commented 11 months ago

Yes, the issue remains after the monitor has been plugged in again. The only workaround I have found so far is to disable the plugin before unplugging and enable it again if the second monitor is connected. This way, unfortunately, I cannot really use the plugin 'just' on my laptop. To reset the extension, I normally delete all saved windows.

Here is a dump of my current config, maybe it helps:

dconf dump /org/gnome/shell/extensions/smart-auto-move/                                                                                                                       [14:14:49]
[/]
activate-workspace=true
debug-logging=false
freeze-saves=false
ignore-position=false
ignore-workspace=false
match-threshold=0.69999999999999996
overrides='{"geary":[{"action":1,"threshold":0.7}],"Slack":[{"threshold":0.75,"action":1}],"com.cisco.anyconnect.gui":[{"threshold":0.7,"action":1}],"com.lakoliu.Furtherance":[{"threshold":0.2999999999999998,"action":1}],"Alacritty":[{"threshold":0.7,"action":1}],"firefox":[{"action":1,"threshold":0.5499999999999998}],"zoom":[{"action":1,"threshold":0.7}],"Spotify":[{"action":1,"threshold":0.7}],"teams-for-linux":[{"action":1,"threshold":0.7}],"org.gnome.Nautilus":[{"action":1,"threshold":0.7}],"obsidian":[{"action":1,"threshold":0.7}],"Zotero":[{"threshold":0.7,"action":1}],"Google-chrome":[{"action":1,"threshold":0.7}],"ONLYOFFICE Desktop Editors":[{"action":1,"threshold":0.7}]}'
save-frequency=2000
saved-windows='{"zoom":[{"id":2793017673,"hash":2793017673,"sequence":92,"title":"Zoom - Licensed Account","workspace":5,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2319,"y":100,"width":376,"height":517,"occupied":true}],"com.cisco.anyconnect.gui":[{"id":2793017584,"hash":2793017584,"sequence":3,"title":"Cisco AnyConnect Secure Mobility Client","workspace":5,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2062,"y":643,"width":475,"height":493,"occupied":true}],"Zotero":[{"id":2793017590,"hash":2793017590,"sequence":9,"title":"data_donation - Zotero","workspace":3,"maximized":3,"fullscreen":false,"above":false,"monitor":1,"x":1920,"y":26,"width":1920,"height":1174,"occupied":true}],"Spotify":[{"id":2793017587,"hash":2793017587,"sequence":6,"title":"Spotify","workspace":5,"maximized":2,"fullscreen":false,"above":false,"monitor":1,"x":2719,"y":26,"width":1117,"height":1174,"occupied":true}],"com.lakoliu.Furtherance":[{"id":2793017586,"hash":2793017586,"sequence":5,"title":"Furtherance","workspace":5,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":1933,"y":57,"width":360,"height":375,"occupied":true}],"Signal":[{"id":2793017691,"hash":2793017691,"sequence":110,"title":"Signal","workspace":4,"maximized":2,"fullscreen":false,"above":false,"monitor":1,"x":2880,"y":26,"width":960,"height":1174,"occupied":false}],"Slack":[{"id":2793017594,"hash":2793017594,"sequence":13,"title":"Slack/XXX","workspace":4,"maximized":2,"fullscreen":false,"above":false,"monitor":1,"x":2880,"y":26,"width":960,"height":1174,"occupied":true}],"geary":[{"id":2793017651,"hash":2793017651,"sequence":70,"title":"Inbox — XXX","workspace":4,"maximized":2,"fullscreen":false,"above":false,"monitor":1,"x":1920,"y":26,"width":960,"height":1174,"occupied":true}],"firefox":[{"id":2793017588,"hash":2793017588,"sequence":7,"title":"bad extension state makes windows immovable (jumping back to previously saved position) · Issue #31 · khimaros/smart-auto-move — Mozilla Firefox","workspace":0,"maximized":3,"fullscreen":false,"above":false,"monitor":0,"x":0,"y":540,"width":1920,"height":1080,"occupied":true}],"Alacritty":[{"id":2793017582,"hash":2793017582,"sequence":1,"title":"Alacritty","workspace":0,"maximized":3,"fullscreen":false,"above":false,"monitor":1,"x":1920,"y":26,"width":1920,"height":1174,"occupied":true}],"org.gnome.Software":[{"id":2793017735,"hash":2793017735,"sequence":154,"title":"Software","workspace":4,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2280,"y":213,"width":1200,"height":800,"occupied":false}],"ONLYOFFICE Desktop Editors":[{"id":2793017742,"hash":2793017742,"sequence":161,"title":"ONLYOFFICE Desktop Editors","workspace":2,"maximized":3,"fullscreen":false,"above":false,"monitor":1,"x":1920,"y":26,"width":1920,"height":1174,"occupied":true}],"com.mattjakeman.ExtensionManager":[{"id":2793017743,"hash":2793017743,"sequence":162,"title":"Extension Manager","workspace":2,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2480,"y":313,"width":800,"height":600,"occupied":false}]}'
startup-delay=2500
sync-frequency=1000
sync-mode='IGNORE'
tmahmood commented 11 months ago

I think this issue exists with any multi-monitor setup. Becomes unusable. I am not able to use it. It would be great if fixed.

khimaros commented 11 months ago

i would like to fix

to do that, i need some help: i am on the road and currently do not have access to an external monitor. if someone could help me come up with a minimal reproduction, that would help a lot.

the steps would be as follows:

1) close all open windows 1) disable the extension: gnome-extensions disable smart-auto-move@khimaros.com 1) clear the settings: dconf reset /org/gnome/shell/extensions/smart-auto-move/ 1) enable the extension: gnome-extensions enable smart-auto-move@khimaros.com 1) open a single (wayland) application window (gnome-terminal works well for this) 1) attach your external monitor and move the window to where you'd like it, ideally everything is still working correctly at this point 1) dump your configuration dconf dump /org/gnome/shell/extensions/smart-auto-move/ 1) attach/detach the monitor, move the window around, log out and in, etc. as needed to reproduce the issue. in all cases, stick to the same single application window 1) dump your configuration dconf dump /org/gnome/shell/extensions/smart-auto-move/ 1) write out the steps taken in this issue and include all config dumps you captured

if you provide this, i will do my best to come up with a fix.

tmahmood commented 11 months ago

Okay, I have reinstalled the extension just now, so it's going to take some time for me to provide anything. Once I start to get the error, I will do the steps you mentioned.

FriederRodewald commented 10 months ago

I did the steps, however, I was unable to reproduce the "constantly moving workspace" error. Instead, the shell crashed and foced me to log in again with all extensions disabled. Here is a short example:

  1. Open the gnome terminal on external monitor.
    [xxx@xxx ~]$ dconf dump /org/gnome/shell/extensions/smart-auto-move/
    [/]
    activate-workspace=true
    debug-logging=false
    freeze-saves=false
    ignore-position=false
    ignore-workspace=false
    match-threshold=0.69999999999999996
    overrides='{}'
    save-frequency=1000
    saved-windows='{"gnome-terminal-server":[{"id":1128693284,"hash":1128693284,"sequence":516,"title":"xxx@xxx:~","workspace":1,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2629,"y":175,"width":1176,"height":763,"occupied":true}]}'
    startup-delay=2500
    sync-frequency=100
    sync-mode='RESTORE'
  2. Power off the system. Unplug external monitor.
  3. Power on the system. Shell opens with all extensions disabled.
  4. Enable extensions through browser and start gnome-terminal.
  5. The shell crashes and logs me out.
  6. Logging in again (extensions are all diabled now) and opening the terminal gives me the following config-dump:
    [xxx@xxx ~]$ dconf dump /org/gnome/shell/extensions/smart-auto-move/
    [/]
    activate-workspace=true
    debug-logging=false
    freeze-saves=false
    ignore-position=false
    ignore-workspace=false
    match-threshold=0.69999999999999996
    overrides='{}'
    save-frequency=1000
    saved-windows='{"gnome-terminal-server":[{"id":3453462702,"hash":3453462702,"sequence":2,"title":"xxx@xxx:~","workspace":1,"maximized":0,"fullscreen":false,"above":false,"monitor":1,"x":2629,"y":175,"width":1176,"height":763,"occupied":true}],"com.mattjakeman.ExtensionManager":[{"id":3453462701,"hash":3453462701,"sequence":1,"title":"Extension Manager","workspace":0,"maximized":0,"fullscreen":false,"above":false,"monitor":0,"x":560,"y":519,"width":800,"height":600,"occupied":false}]}'
    startup-delay=2500
    sync-frequency=100
    sync-mode='RESTORE'
  7. Repeating enabling the extension leads (again) to crash. After 3 times, the shell starts to change colors every 2 seconds, seemingly blinking between two different sets.

I don't know whether this helps. For now, my workaround is to disable the extension before powering down the system if I intend to unplug the second monitor. This issue seems connected/similar to #41 .

khimaros commented 2 months ago

FYI, no progress on fix but i believe i now have a way to reproduce this.

khimaros commented 2 months ago

WORKAROUND AVAILABLE i've found that if a specific window is exhibiting this behavior, you can open the "Saved Windows" preferences tab for smart-auto-move and "DELETE" any instances of that application. after doing this, it seems to return to normal behavior.