I didn't know how to explain my issue shortly, so I apologize for a bit confusing Summary.
The issue is, that on my multi monitor setup (where the second monitor is an extended monitor to the primary one, and is a TV connected via HDMI), an app (no matter which), when started, sometimes ends up on primary screen, sometimes on the extended (second screen). I have no way of predicting where it will be displayed, so the process is entirely random.
Steps to Reproduce:
I don't know, as I said it's random. I didn't move cursor to the second screen when the app window was loading.
App window sometimes displays on the primary monitor, sometimes on the extended monitor
App window displays on the "Primary Monitor" (as on Windows and GNOME) and I can drag it on the extended monitor if necessary.
Plasma Git Master after 5.4 branching, Qt-5.5.0, Intel Graphics
I have exactly the same setup and exactly the same problem. This is especially annoying when the TV is off and the new window invisibly pops up on that display instead of the one my mouse is on.
There used to be a "Pop up window on screen with mouse" option that I can't find anymore.. but that didn't seem to work for me either.
Sorry for the late response.
> App window sometimes displays on the primary monitor, sometimes on the extended monitor
This is something we do not really control. Windows have the possibility to position themselves when they show. They indicate this through window hints to the window manager and KWin (Plasma's window manager) honors this request. See https://tronche.com/gui/x/icccm/sec-4.html#s-184.108.40.206 for more information. If KWin sees a window with a position set it assumes that the window has more information about where to go than the window manager. Apparently this seems to be wrong in some cases. I appreciate any information about windows which show this behavior.
For windows showing incorrect behavior you can override this with a window specific rule to ignore the requested position. With that KWin places the window and for that follows the "active screen" - that's to KWin either the window with the currently active window or the screen containing the mouse cursor (depending on config option).
Thanks for your reply and your great job ;-)
KDE/Openbox session (or just run openbox --replace in your konsole) is able to fix such issue: GIMP and LibreOffice's splash will NOT shown in the extended (but correctly in the primary) screen any more https://pbs.twimg.com/media/CnIQr9DUMAQCuRO.jpg
And I find setScreen(QScreen*) is not able to work for Qt-5.7.0 https://github.com/xiangzhai/qwx/commit/9419eabf0fa689fba5046b7e606b0007db7a90a6
As Martin suggested the active screen is configurable https://blog.martin-graesslin.com/blog/2016/07/multi-screen-woes-in-plasma-5-7/ Newly opened windows not placed on the primary screen
kcmshell5 kwinoptions for the Multiscreen behaviour, both check separateScreenFocus && activeMouseScreen shown as https://pbs.twimg.com/media/CnIya4IUkAAc72h.jpg then newly opened window will shown in the PRIMARY screen ;-)
> And I find setScreen(QScreen*) is not able to work for Qt-5.7.0
Can you please xprop such a window. I would like to see what it sets in the normal hints.
I pasted xprop here https://forum.isoft-linux.org/viewtopic.php?f=4&t=32&p=134#p134
> kcmshell5 kwinoptions for the Multiscreen behaviour, both check separateScreenFocus && activeMouseScreen shown as https://pbs.twimg.com/media/CnIya4IUkAAc72h.jpg then newly opened window will shown in the PRIMARY screen ;-)
but kwinoptions works happily!
user specified size: 480 by 822
window gravity: Static
that doesn't specify a position. Uh oh, what's going on there?
app.primaryScreen()->availableGeometry() output is QRect(0,0 1366x732)
PS: kwinoptions separateScreenFocus && activeMouseScreen works happily!
(In reply to Martin Gräßlin from comment #7)
> that doesn't specify a position. Uh oh, what's going on there?
Either the window doesn't specify a position (what's good) or yet another QWidget/Window call ending nowhere.
Since netwm is completely multiscreen unaware, it would afaics require some call like KStartupInfoData::setXinerama(.) to define a specific screen - there's no real protocol.
One could btw. specify a blind rule to have all windows always show on screen 1.
> One could btw. specify a blind rule to have all windows always show on screen 1
kwinoptions separateScreenFocus && activeMouseScreen helps to have all windows always show on screen with activeMouse ;-)
Yes, even if I had not known, I would have heard - but that is not the same as enforcing the primary screen :-)