Bug 489640

Summary: Windows always open on the wrong screen after reopening without moving the cursor
Product: [Plasma] kwin Reporter: Luca Saalfeld <luluklzde>
Component: multi-screenAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: chiitoo, fanzhuyifan, luluklzde, nate, xaver.hugl
Priority: NOR Keywords: multiscreen
Version First Reported In: 6.1.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=490691
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Luca Saalfeld 2024-07-02 23:22:57 UTC
SUMMARY
Windows always open on the left screen after reopening without moving the cursor

STEPS TO REPRODUCE
1. Open any app
2. Close the app
3. Reopen the app without moving the cursor since step 2

OBSERVED RESULT
App window opens on the left screen

EXPECTED RESULT
App window opens on the screen the cursor is on

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.7-zen1-1-zen (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
If I open something for the first time everything is fine. Every app opens on the monitor the cursor is on.
Closing the app, then opening it again - without moving the cursor - opens them on my left screen. Any further launches also starts on the left screen.
Moving the cursor after closing the app causes it to launch normally (normally as in the bug is still there. This single relaunch is fine. Reopen without moving the mouse again still causes the bug).
Comment 1 Luca Saalfeld 2024-07-02 23:30:07 UTC
This also happens with the application launcher.
https://bugs.kde.org/show_bug.cgi?id=487945 is essentially this bug, but only for the application dashboard.
Comment 2 Nate Graham 2024-07-03 17:30:50 UTC
Does the issue reproduce in a new clean user account?
Comment 3 Luca Saalfeld 2024-07-03 21:30:38 UTC
Yes, the bug still occurs.
Comment 4 Luca Saalfeld 2024-07-04 10:46:59 UTC
I just found it that this bug is not app specific.
If a window launches on the left screen (i.e. the bug occurs), *all* windows launch on the left screen, no matter of what app it belongs to.
Comment 5 Luca Saalfeld 2024-07-05 22:12:50 UTC
There's apparently another version of this bug, where the right monitor is the one everything is placed on. That's at least what is happening right now.
My guess is that's it's not monitor position specific (only the left monitor), but instead just choosing the wrong monitor to place new windows on. I could create a setup with more monitors to test this, but the other ones will have a lower resolution :/
Comment 6 Luca Saalfeld 2024-07-06 09:51:38 UTC
This also affects the task switcher.
I think that this bug simply affects everything, that spawns a window.
Comment 7 Luca Saalfeld 2024-07-14 11:47:59 UTC
Should have updated title and status quite a bit before, but I just forgot to do that
Comment 8 Luca Saalfeld 2024-07-22 09:17:40 UTC
So I have new information:
The new windows spawn above the window with the current focus, not on the screen where the mouse is.

So the mouse position is only relevant *once* for new windows, after that the monitor on which the active window is, is prioritized.
Comment 9 Zamundaaa 2024-11-04 21:22:22 UTC
If you enable "separate screen focus" in the window behavior settings, does this work as expected again?
Comment 10 Luca Saalfeld 2024-11-04 21:51:34 UTC
So, I had it already enabled.
I disabled it and no change. I enabled it again and now it works as expected.

Honestly, this is one of the options I overlooked when I created the issue.
Comment 11 Zamundaaa 2024-11-04 23:38:25 UTC
Okay. The option was turned on by default, maybe something went wrong... If you delete the SeparateScreenFocus line from ~/.config/kwinrc and reboot, can you reproduce the broken behavior again?
Comment 12 Luca Saalfeld 2024-11-05 10:45:52 UTC
That line doesn't exist.

If separate screen focus is disabled, the option you mentioned gets created (with the value to false).
If separate screen focus is enabled, the line gets deleted.
Comment 13 Luca Saalfeld 2024-11-05 10:55:47 UTC
You know how I've written that "it works as expected"?

I've been so used to "focus follows mouse", that I didn't quite remember what the bug *exactly* was.
I have tested this on the desktop with one window open, but I forgot that the desktop itself acts like a window.

No, it has not been fixed, nor has "separate screen focus" changed the bug. In terms of this bug, it does nothing.


New windows will still appear on the screen the focused window is on, instead of the screen the mouse is on.
I'm sorry for the confusion.

(I've tried window placement: "under mouse", too, but that hasn't changed anything. I just wanted to mention it, since I didn't do that yet.)
Comment 14 Zamundaaa 2024-11-05 12:33:16 UTC
(In reply to Luca Saalfeld from comment #13)
> New windows will still appear on the screen the focused window is on,
> instead of the screen the mouse is on.
> I'm sorry for the confusion.
No, they appear on the screen with the last user interaction. It sounds like that's working fine.
Comment 15 Luca Saalfeld 2024-11-05 12:44:56 UTC
So TL:DR of report: it's not a bug, I just thought it was one.