Bug 425798

Summary: Windows don't open on primary screen with default window behavior settings
Product: [Plasma] kwin Reporter: Claudius Ellsel <claudius.ellsel>
Component: multi-screenAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: aspotashev, kde, nate, plasma-bugs
Priority: NOR Keywords: usability
Version: 5.19.0   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Dual screen setup

Description Claudius Ellsel 2020-08-25 19:29:25 UTC
SUMMARY
On Wayland with two monitors set up the windows seem to appear always on the wrong screen for me. Is there something I have to set up to make it work as expected or is this functionality still missing?
Comment 1 Claudius Ellsel 2020-08-25 19:30:29 UTC
BTW: This also happened to the overlay for shutting down the computer. Might be a different bug, though.
Comment 2 Nate Graham 2020-08-25 21:53:10 UTC
Can you define "on the wrong screen"? What is it that you expect, and what happens instead?
Comment 3 Claudius Ellsel 2020-08-26 13:50:59 UTC
Created attachment 131202 [details]
Dual screen setup

See my monitor setup attached. The applications always start on the left vertical screen, while I want them to start on the right horizontal screen with the panel. (Or remember their position, but that would be a different bug probably ;)).

I start the applications either through the application launcher (Kicker) or by clicking the icon in the icon only task manager on the panel.

This also happened with Firefox now on X11 for me, but might have a different cause.
Comment 4 Claudius Ellsel 2020-09-07 00:14:43 UTC
After using the setup for some time now, I can report that sometimes apps (Firefox) open on one screen and sometimes on the other. Most times on the "wrong" screen, though.
Comment 5 Claudius Ellsel 2020-09-08 14:41:21 UTC
Just had some more testing. I used default settings before. After selecting "active screen follows mouse" it works on Wayland (and on X11).

Apparently one has to click the screen to make it the active one else?

I expected to have the primary one to be the active one after login, if the "active screen follows mouse" option is not selected.

So I still consider the current default setting to be not working as expected.

Since this is probably not Wayland related, I am removing the keyword and adjust the title.
Comment 6 David Edmundson 2020-09-08 15:50:47 UTC
The current default starts at 0,0 which will be the upper left and fills out.

There is no attempt to take primary screen into account, so AFAIK all code is working as-intended.

Though that still leaves the open question of whether the code intention matches user expectation.
Comment 7 Claudius Ellsel 2020-09-08 17:08:01 UTC
(In reply to David Edmundson from comment #6)
> The current default starts at 0,0 which will be the upper left and fills out.

Ah, makes sense, then.

> There is no attempt to take primary screen into account, so AFAIK all code
> is working as-intended.
> 
> Though that still leaves the open question of whether the code intention
> matches user expectation.

It was not my expectation at least. I set up my monitors and saw the "primary" option. I thought that would have some effect.

Some options that came to my mind:

- Change the code to maybe consider the primary monitor setting for that
- If a change is not wanted (this might not be the intended behavior) introduce an additional option and make it default
- Make the option "active window follows mouse" the default

To me the second option seems to make the most sense, even if a change would be ok. This offers an additional option, so the user has more room to choose from if he prefers the current default behavior.
Comment 8 Nate Graham 2020-09-08 19:46:28 UTC
I thought Wayland didn't have a concept of "primary screen"? So is this X11-specific?
Comment 9 Claudius Ellsel 2020-09-09 12:28:35 UTC
(In reply to Nate Graham from comment #8)
> I thought Wayland didn't have a concept of "primary screen"? So is this
> X11-specific?

Happening on both X11 and Wayland, due to the reason David mentioned, I guess. In the comment above, I forgot that there is no "primary screen" in Wayland. Sorry introducing confusion and unnecessary noise by that.

Most options I gave are thus probably no longer applicable.

My knowledge about what options are possible or sensible is limited. However, to me the only option to mitigate the problem seems to make "active window follows mouse" the default? Is this ok to do (and will this introduce unwanted side effects)?
Comment 10 Claudius Ellsel 2020-10-15 15:48:55 UTC
A short ping, since the discussion seems to be stalled, currently.
Comment 11 Claudius Ellsel 2020-11-11 21:49:13 UTC
Changing "active screen follows mouse" to true by default seems to be a good first step to mitigate the problems.

Corresponding line seems to be https://invent.kde.org/plasma/kwin/-/blob/master/kwin.kcfg#L105. Since other problems that got fixed by https://invent.kde.org/plasma/kwin/-/merge_requests/130 it seems to be a bit harder to change the default, though.
Comment 12 Vlad Zahorodnii 2020-11-20 08:32:23 UTC
You would need to flip the default value of SeparateScreenFocus and ActiveMouseScreen in kwin.kcfg and kcmkwin/kwinoptions/kwinoptions_settings.kcfg. Hope that helps.

As for regressions, I've been using kwin with those options turned on for about a year or two and haven't found any serious issues.
Comment 13 Nate Graham 2020-11-20 14:58:36 UTC
Perhaps we should change the defaults in this case? Would that make sense?
Comment 14 Claudius Ellsel 2020-11-20 15:10:13 UTC
Thanks for the hints. I could look into this soon, although don't really have time to also test the change probably. So if somebody else wants to do it...
Comment 15 Claudius Ellsel 2020-11-20 17:24:36 UTC
Either CCBUG did not work or the bot is currenlty not active. I started a MR: https://invent.kde.org/plasma/kwin/-/merge_requests/468.
Comment 16 Vlad Zahorodnii 2020-11-27 08:18:06 UTC
Git commit bcba2e252f58edbeb0c6b790df1a4148656ec981 by Vlad Zahorodnii, on behalf of Claudius Ellsel.
Committed on 27/11/2020 at 08:18.
Pushed by vladz into branch 'master'.

Change the defaults for active screen

As suggested in https://bugs.kde.org/show_bug.cgi?id=425798#c12.

M  +1    -1    kcmkwin/kwinoptions/kwinoptions_settings.kcfg
M  +1    -1    kwin.kcfg

https://invent.kde.org/plasma/kwin/commit/bcba2e252f58edbeb0c6b790df1a4148656ec981
Comment 17 Vlad Zahorodnii 2020-11-27 08:18:14 UTC
Git commit bcba2e252f58edbeb0c6b790df1a4148656ec981 by Vlad Zahorodnii, on behalf of Claudius Ellsel.
Committed on 27/11/2020 at 08:18.
Pushed by vladz into branch 'master'.

Change the defaults for active screen

As suggested in https://bugs.kde.org/show_bug.cgi?id=425798#c12.

M  +1    -1    kcmkwin/kwinoptions/kwinoptions_settings.kcfg
M  +1    -1    kwin.kcfg

https://invent.kde.org/plasma/kwin/commit/bcba2e252f58edbeb0c6b790df1a4148656ec981
Comment 18 Nate Graham 2020-11-28 04:24:38 UTC
Should this be marked as resolved now that the defaults have been changed (since that's what the bug report is about?)
Comment 19 Claudius Ellsel 2020-11-28 16:42:33 UTC
Currently that MR caused problems with tests that I don't really know how to fix and will thus probably reverted for now.

Also I am not sure whether this MR fixes the underlying problem of this bug. Possibly that is the case, since there is probably no better way to set the active screen where windows are opened for now and there are already other bugs for remembering window positions on Wayland.
Comment 20 Nate Graham 2021-03-21 17:09:13 UTC
Looks like it was reverted. :( I see that the code is supposed to enable "active screen follows mouse" mode when you're not using the "click to focus" setting. Are you using it? If not, that would be seem to be a bug.
Comment 21 Bug Janitor Service 2021-04-05 04:33:28 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 22 Bug Janitor Service 2021-04-20 04:33:17 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now 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

Thank you for helping us make KDE software even better for everyone!