Bug 469034 - Windows are lost in missing displays when detaching external monitors on Wayland
Summary: Windows are lost in missing displays when detaching external monitors on Wayland
Status: RESOLVED DUPLICATE of bug 452118
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: 5.27.4
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-27 07:03 UTC by adr.fantini
Modified: 2023-12-01 00:33 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adr.fantini 2023-04-27 07:03:12 UTC
SUMMARY
I use a 3x3 virtual desktop setup on Wayland.

Very often, after detaching external monitors, windows are "lost" in them, meaning that they are still placed on phantom monitors that do not exist anymore.

STEPS TO REPRODUCE
1. Set virtual desktop arrangement to 3x3 (I have not verified this with other desktop arrangements)
2. Connect external monitors (I use 3 monitors side-by-side)
3. Open a bunch of windows (e.g. several browser windows) in different virtual desktops and screens
4. Detach external display(s)

OBSERVED RESULT
Some windows are hidden/lost, as if they are not moved away from detached displays.
Most of the time, but not always, minimising and maximising them a couple of times from the panel restores them to the correct screen. Sometimes, they need to be forcefully closed and reopened (losing potential work done).

When this happens, the Desktop Pager widget even shows these additional "lost" windows in a separate display, outside of the 3x3 Virtual Desktops matrix, as an additional virtual desktop in the first row (so instead of 3 virtual displays per row, I have 4 in the first, then 3 and 3)

EXPECTED RESULT
All windows are properly moved to the remaining display.

SOFTWARE/OS VERSIONS
Linux: Archlinux
KDE Plasma Version: 5.27.4 on Wayland
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Comment 1 David Edmundson 2023-04-27 07:16:04 UTC
We could not reproduce (albeit with a 2 monitor case)

Can you confirm window positions using the kwin debug console. Search for "kwin" in krunner and it should appear.
If you can make note of the position before and after as well as if you have any active kwin scripts that could be affecting this.

Can you confirm if the virtual desktop part is important?
Comment 2 David Edmundson 2023-04-27 07:17:20 UTC
*** Bug 468538 has been marked as a duplicate of this bug. ***
Comment 3 Naxdy 2023-04-27 08:19:59 UTC
Not OP, but I experience the same issue. Using KWin's debug console, I was able to gather the following positions for affected windows:

Out of bounds:
Telegram Desktop: 6513, 32
KeepassXC: 6513, 32

Not out of bounds:
Telegram Desktop: 4070, 32
KeepassXC: 4070, 32
(yes, they are both placed in the same location on purpose, however even when they aren't in the same location upon display entering sleep, they sometimes are placed out of bounds on wakeup)

I don't use virtual desktops at all, so I do not believe this plays a role in this. Also, this is with a single monitor setup (though there has been a second monitor in form of a virtual output connected in the past if that matters).
Comment 4 adr.fantini 2023-04-27 08:43:23 UTC
(In reply to David Edmundson from comment #1)
> We could not reproduce (albeit with a 2 monitor case)
> 
> Can you confirm window positions using the kwin debug console. Search for
> "kwin" in krunner and it should appear.
> If you can make note of the position before and after as well as if you have
> any active kwin scripts that could be affecting this.
> 
> Can you confirm if the virtual desktop part is important?

I have not experienced this in other cases, only when going from 3 monitors to 1. But I cannot guarantee:
- that virtual desktops are part of the issue
- that this specific multimonitor setup is to blame

Personally, sleep does not seem to affect it, it's unplugging the external monitors that triggers the issue.

I can provide the required additional info; can you specify which debug fields you are interested in? There are a lot of them, I'd love to copy them all but apparently I cannot select them all / copy them. Or is there a neat trick to do so, or a CLI interface to do the same?
Comment 5 Naxdy 2023-04-27 14:09:12 UTC
Just quick drop by to report that Dolphin has disappeared to 6513, 4727 (this is well out of bounds considering my monitor is 5120x1440). Its previous position was 4070, 831.
Comment 6 fanzhuyifan 2023-11-30 23:48:52 UTC
Should this be considered a duplicate of https://bugs.kde.org/show_bug.cgi?id=452118 ?
Comment 7 Nate Graham 2023-12-01 00:32:14 UTC
Yep, same thing for sure.

*** This bug has been marked as a duplicate of bug 452118 ***