SUMMARY *** This is a simple one (to describe at least). When turning a screen off or disconnecting it, the windows move on to the main screen. This is good. However, if that second screen is reconnected or turned back on, the windows do not go back onto the second screen. *** STEPS TO REPRODUCE 1. Disconnect screen 2. Reconnect screen 3. OBSERVED RESULT On re-connection, the windows do not move back on to the second screen. It instead shows the desktop. Windows remain on the first screen. EXPECTED RESULT On re-connection, the windows should move back on to the second screen SOFTWARE/OS VERSIONS KDE 5.24.5 on Xorg
That's what they're supposed to do. If they don't, it's a bug.
Maybe, we'd need to have a logic for that to happen though. As it is, once a window is moved (because it's dragged or because it was moved for the display was disconnected) the window belongs there.
I could have sworn this was what it did on Wayland, but now that I test again, I see that you're right. When the screen is disconnected, windows move over to a still-connected screen, but when the disconnected screen is re-connected, they don't return there. We maybe need to conditionalize the logic so that a window only belongs to a screen if the user takes action to move it there from another, and thereafter that's its preferred screen such that it will automatically move there if that screen is reconnected. Belongingness shouldn't be updated due to automatic movements, only user-initiated ones. This is what KXMLGUI tries to do manually for KDE app windows on X11. Of course it can't do everything like KWin can on Wayland.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2573
*** Bug 456681 has been marked as a duplicate of this bug. ***
Please make sure this handles the use case I mentioned in https://bugs.kde.org/show_bug.cgi?id=456681 in which multiple screens are turned off and on in a very short period of time, which might cause multiple screen disconnects before everything is restored back to normal. An example of what would cause this: a power blip. IMO, a delay of a few seconds in which KDE doesn't move windows at all is preferable to moving them instantaneously when a screen disappears, and then again when another screen disappears, and then trying to restore all that back to the original configuration when both screens reappear.
*** Bug 458053 has been marked as a duplicate of this bug. ***
*** Bug 452247 has been marked as a duplicate of this bug. ***
Git commit ba0799974ed7b30b973c6a6a40c35be4d30d2ca2 by Xaver Hugl. Committed on 31/08/2022 at 20:30. Pushed by zamundaaa into branch 'master'. workspace: restore window position after output changes Related: bug 374908, bug 444082, bug 454003, bug 453589 M +1 -0 src/CMakeLists.txt A +197 -0 src/placementtracker.cpp [License: GPL(v2.0+)] A +68 -0 src/placementtracker.h [License: GPL(v2.0+)] M +6 -0 src/window.cpp M +3 -0 src/window.h M +29 -0 src/workspace.cpp M +3 -0 src/workspace.h https://invent.kde.org/plasma/kwin/commit/ba0799974ed7b30b973c6a6a40c35be4d30d2ca2
*** Bug 460454 has been marked as a duplicate of this bug. ***