Bug 412703 - Unplugging external monitor repositions windows to right side of screen
Summary: Unplugging external monitor repositions windows to right side of screen
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 161325 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-07 16:35 UTC by Marko Gobin
Modified: 2022-11-15 18:24 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24


Attachments
external display (1.48 MB, image/png)
2022-01-14 00:28 UTC, Marko Gobin
Details
laptop display after unplug (710.31 KB, image/png)
2022-01-14 00:28 UTC, Marko Gobin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Gobin 2019-10-07 16:35:21 UTC
SUMMARY
Unplugging external monitor repositions windows to right side of screen.

STEPS TO REPRODUCE
1. Connect external monitor
2. Display some windows/apps on external monitor
3. Unplug external monitor

OBSERVED RESULT
All windows are moved to laptop screen but they are repositioned to right side of the screen.

EXPECTED RESULT
Windows positions should remain the same on laptop screen (e.g. centered windows must remain centered)

ADDITIONAL INFORMATION
Same issue occures also in Deepin DE since it now uses kwin as default WM.
Comment 1 Vlad Zahorodnii 2021-10-30 14:03:05 UTC
Git commit 4928f4db5b810969c70d549729c23ff95d1a6781 by Vlad Zahorodnii.
Committed on 30/10/2021 at 14:02.
Pushed by vladz into branch 'master'.

Try to preserve window position relative to their outputs during hotplug

Currently, if an output is hotplugged, all windows will be scrambled,
which is highly annoying.

With this change, windows will stick to their outputs if an output has
been connected or disconnected.
Related: bug 296673, bug 378896, bug 443698

M  +10   -12   src/abstract_client.cpp

https://invent.kde.org/plasma/kwin/commit/4928f4db5b810969c70d549729c23ff95d1a6781
Comment 2 kde.org 2021-11-06 12:05:37 UTC
*** Bug 161325 has been marked as a duplicate of this bug. ***
Comment 3 Marko Gobin 2022-01-14 00:28:08 UTC
Created attachment 145437 [details]
external display
Comment 4 Marko Gobin 2022-01-14 00:28:44 UTC
Created attachment 145438 [details]
laptop display after unplug
Comment 5 Marko Gobin 2022-01-14 00:30:32 UTC
I just tested this on latest 5.24 beta and issue is still not resolved.
Check attached screenshots.
Kate was centered but after unplug it was moved to bottom and on right.
Comment 6 Alberto Torres Ruiz 2022-10-30 14:28:23 UTC
This has been an issue for me for many years. But I should add that my main (external) screen is much larger (4k). All windows seem to retain their size but not their position after disconnecting and reconnecting it. It's extremely annoying and disorienting. It also happens when one of the screens go to sleep by itself.

I'm commenting on this bug and not one that sounds more relevant because those are marked as duplicates of this one, so I guess it's considered the same issue.

It happened in all distros I've used: Kubuntu, Arch, SteamOS 3.x... All x64, maybe one ARM. Currently using KDE 5.90.0, kwin 5.23.5. All X11.
Comment 7 Nate Graham 2022-10-31 18:15:39 UTC
There's a new fix in Plasma 5.26; please try again there. Thanks.
Comment 8 Bug Janitor Service 2022-11-15 05:15:35 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Alberto Torres Ruiz 2022-11-15 18:24:24 UTC
Yesterday I could confirm that it's fixed in kwin 5.26.1. I'm sorry for the delay.

When I reconnect the external display, all unmodified windows go back to their original places.

If a window was moved when the external display is disconnected it remains moved after, but that's not really a bug, and it works well using the kwin script "restoreToScreen". (this script didn't work in the old version either)