Bug 443697 - KDE does not respect "primary" screen settings when launching applications and using multiple screens
Summary: KDE does not respect "primary" screen settings when launching applications an...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-multiscreen (other bugs)
Version First Reported In: 5.22.5
Platform: Other Linux
: NOR minor
Target Milestone: 1.0
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-14 07:12 UTC by K Freed
Modified: 2022-03-01 22:24 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.24
Sentry Crash Report:


Attachments
Example of bug (top bar represents edge of laptop screen, konsole and Dolphin were just launched and window was not yet resized) (619.32 KB, image/png)
2021-10-14 07:12 UTC, K Freed
Details
Display configuration system settings (56.95 KB, image/png)
2021-10-14 07:13 UTC, K Freed
Details
system settings -> window management -> advanced -> window placement (53.91 KB, image/png)
2021-10-15 10:33 UTC, K Freed
Details

Note You need to log in before you can comment on or make changes to this bug.
Description K Freed 2021-10-14 07:12:53 UTC
Created attachment 142420 [details]
Example of bug (top bar represents edge of laptop screen, konsole and Dolphin were just launched and window was not yet resized)

SUMMARY
When I connect my laptop to a new monitor and change the screen configuration to have one screen on top of another, some applications open in the middle of both screens and seem to completely ignore screen boundaries. 

STEPS TO REPRODUCE
1. Change screen configuration to one on top of another
2. Launch a few applications
3. Some applications will spawn in the middle of both screens

OBSERVED RESULT
Applications spawn in the middle of both screens, which is especially bad if one screen is not working.

EXPECTED RESULT
Applications spawn on the screen marked "primary" just as it would when a second screen was not connected. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kernel 5.10, Arch linux (EndeavourOS)
(available in About System)
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Primary Screen: Laptop Screen (1366x768)
Graphics card: Intel UHD620 using the i915 video driver
Connection method: Built-in HDMI port
Screen resolution(s): 1366x758(Laptop) 1920x1080 (external monitor 1) 3840x2160 (external monitor 2)
Replica of: None
Bug screenshot is attached. Top bar represents laptop screen edge
Comment 1 K Freed 2021-10-14 07:13:48 UTC
Created attachment 142421 [details]
Display configuration system settings
Comment 2 David Edmundson 2021-10-14 12:20:38 UTC
>KDE does not respect "primary" screen settings when launching applications

We never did.
Things shouldn't open in the middle though. 

Please include your system settings -> window management -> advanced -> window placement setting
Comment 3 K Freed 2021-10-15 10:33:54 UTC
Created attachment 142469 [details]
system settings -> window management -> advanced -> window placement
Comment 4 Cristiano Guadagnino 2021-10-25 16:04:27 UTC
I have a similar problem. Not sure if it is correct to comment on this bug, but the underlying problem may be the same.

I have two external monitors next to each other.

In the past I have always been bothered by the fact that a lot of application windows did not open on my primary monitor (which is the right one).

Now, after the recent update to plasma 5.23, the situation is much worse:
- most application windows open on the left screen
- even if I immediately drag them to the right one, they will still open on the left one the next time
- dialogs always open on the left screen, even if the main window is on the right one
- "start" menu opens on the left screen even if the button to open it is on the right screen (I am using "Application Dashboard" on a top panel)
- sometimes even opening a context menu (right-click menu) on an icon on the right screen will show the menu on the left screen

I am seeing David Edmundson reply on comment 2, saying that KDE never followed the primary screen to open new windows. That may be ok, but I would at least expect windows to open on the screen where the mouse pointer is.
That is not the case, unfortunately.
Note that, in "System Settings" => "Window Management" => "Focus" I have the "Mutiscreen behavior" set as "Active screen follows mouse".

If you do not use the primary screen nor use the active screen, how do you decide where to open a new window?

I am using openSuse Tumbleweed updated to version 20211021.
Comment 5 K Freed 2021-10-25 17:54:59 UTC
I updated the bug title to reflect that this bug seems to affect anyone using multiple screens.
Comment 6 Cristiano Guadagnino 2021-10-27 13:52:49 UTC
I'm now using openSuse Tumbleweed version 20211024 and most bugs seem to be fixed.
I also found a KWin script named "Always Open on Active Screen" by Natalie Clarius that helped. However, I find that things work correctly now even on my second PC where I did not apply that KWin script.
The only problem remaining is that Dolphin keeps opening on the left screen, but I'm not convinced it's a problem in Plasma, as my second PC does not exhibit this behavior anymore. 
Both PCs are running openSuse Tumbleweed version 20211024.
Comment 7 Cristiano Guadagnino 2021-10-27 13:54:40 UTC
(In reply to Cristiano Guadagnino from comment #6)
> I'm now using openSuse Tumbleweed version 20211024 and most bugs seem to be
> fixed.
> I also found a KWin script named "Always Open on Active Screen" by Natalie
> Clarius that helped. However, I find that things work correctly now even on
> my second PC where I did not apply that KWin script.
> The only problem remaining is that Dolphin keeps opening on the left screen,
> but I'm not convinced it's a problem in Plasma, as my second PC does not
> exhibit this behavior anymore. 
> Both PCs are running openSuse Tumbleweed version 20211024.

I should stress that the desired behavior, in my case, is that windows open on the active screen, rather than the primary (which would be my second choice).
Comment 8 Cristiano Guadagnino 2021-10-27 13:56:47 UTC
(In reply to Cristiano Guadagnino from comment #6)
> I'm now using openSuse Tumbleweed version 20211024 and most bugs seem to be
> fixed.
> I also found a KWin script named "Always Open on Active Screen" by Natalie
> Clarius that helped. However, I find that things work correctly now even on
> my second PC where I did not apply that KWin script.
> The only problem remaining is that Dolphin keeps opening on the left screen,
> but I'm not convinced it's a problem in Plasma, as my second PC does not
> exhibit this behavior anymore. 
> Both PCs are running openSuse Tumbleweed version 20211024.

Sorry, one more thing: openSuse Tumbleweed 20211024 means Plasmashell 5.23.1.
Comment 9 Alex 2022-01-18 09:29:20 UTC
I have a similar problem in plasma 5.23.5 for kubuntu with two 4K monitors: I keep apps semi-maximized on various corners or half of the screens, but everytime I open the apps they appear in semi-random places, on the wrong monitor.

In my window placement setting I set "Allow apps to remember the position of their own windows"
Comment 10 Marco Martin 2022-01-18 15:33:20 UTC
is this a KWin issue?
Comment 11 K Freed 2022-03-01 06:54:00 UTC
This seems to work way better now with apps opening in the screen that the mouse is on. Still not perfect though especially for apps like MPV that open in full screen
Comment 12 Alex 2022-03-01 07:33:57 UTC
I'm running kde 5.24.2 and I continue to have the issue: for example when I hit the "edit" button on a displayed kalarm the new window to set date opens at a random position on the wrong monitor.

It's even a mess to find it!
Comment 13 Cristiano Guadagnino 2022-03-01 11:09:19 UTC
I'm on Plasma 5.24.2 here too, and still having the issue, although less severe.
One major example is Dolphin: it *always* opens on my left screen, even if the right screen is the primary one and my mouse is on the right screen.
Under Window Management => Window Behavior, I have the "Active screen follows mouse" option set, and the "Separate screen focus" option unset.
I also installed and activated the "Always open on Active Screen" kwin script, but nothing changes with respect to Dolphin's behavior.
Dolphin is not the only one showing this behavior... it frequently happens with "utility" windows too.
Comment 14 Natalie Clarius 2022-03-01 15:37:20 UTC
Do you people for who windows peristently open on the leftmost monitor perhaps have window rules specifying an initial window position?  
Because the x, y parameters are not relative to the initial screen, but to the area of all screens combined, i.e. effectively the top-leftmost monitor. If you have two 1920px wide screens next to each other, x=0 will always be the left edge of the left monitor, and the left edge of the right monitor will be x=1920.
Of course it would be nice to have window rules to specify window geometry relative to the screen geometry rather than absolute values.
Comment 15 Natalie Clarius 2022-03-01 15:39:32 UTC
(In reply to Cristiano Guadagnino from comment #13)

> I also installed and activated the "Always open on Active Screen" kwin
> script, but nothing changes with respect to Dolphin's behavior.

Cold you please open an issue on GitHub https://github.com/nclarius/KWin-window-positioning-scripts/issues/new so I can look into it?
Comment 16 Nate Graham 2022-03-01 21:05:49 UTC
In general apps don't respect the primary screen setting when launching. However, on X11, it is up to the app, so some apps will, and some apps won't. In addition, some apps specify a manual location to be launched at, irrespective of which screen is the primary one. It's a mess, and it's not easily fixable. But generally, issues here are bugs in apps themselves.

On Wayland, or on X11 for apps that don't specifically request a location to launch at, apps will be launched at a location of the window manager's choosing. Issues here are bugs in KWin.

It seems like the originally-reported issue is fixed now, so let's close the bug before it turns into a grab-bag of people reporting random unrelated multi-monitor issues. For people still experiencing different issues, please file new bug reports. Thanks!
Comment 17 Cristiano Guadagnino 2022-03-01 22:19:53 UTC
(In reply to Natalie Clarius from comment #14)
> Do you people for who windows peristently open on the leftmost monitor
> perhaps have window rules specifying an initial window position?  

I have no window rules.
Comment 18 Cristiano Guadagnino 2022-03-01 22:24:06 UTC
(In reply to Natalie Clarius from comment #15)
> Cold you please open an issue on GitHub
> https://github.com/nclarius/KWin-window-positioning-scripts/issues/new so I
> can look into it?

Done. It is issue #9.