Bug 409979

Summary: Kwin rules forcing all windows to single monitor do not (always) apply.
Product: [Plasma] kwin Reporter: leftcrane <leftcrane>
Component: rulesAssignee: KWin default assignee <kwin-bugs-null>
Severity: normal CC: isma.af, tata668
Priority: NOR    
Version: 5.15.3   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.25

Description leftcrane 2019-07-19 08:16:02 UTC

1. Connect two displays, with the primary display on the RIGHT of the secondary one.
2. Create a Kwin rule forcing all windows to Monitor 1 (which should be your primary display in this context).
3. Disconnect the secondary left-hand display.
4. Reboot. (Maybe logging out is sufficient, not sure).
5. Open some windows (you are now just using one monitor).
6. Connect the secondary display.


All Windows shift from the display you were using to the freshly connected secondary display. To get the rule to catch, you have to disable and re-enable it.


The rule should force the windows to the display at all times.

This rule is very handy when the origin of the display assembly isn't located inside the primary monitor. Without this rule, Kwin will move all your windows to the secondary display when you connect it, which is extremely disruptive.

Ofc the ideal solution would be for Kwin to ensure that windows stay on the primary display when the assembly changes, but in the meantime the rule is an indispensable hack. 

(perhaps a better setting would be to a "force to primary display" rule, since monitor numbers are confusing and unstable)

Operating System: Kubuntu 19.04
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2
Kernel Version: 5.0.0-20-generic
OS Type: 64-bit
Comment 1 Martin Flöser 2019-07-19 09:00:18 UTC
Rules are not evaluated when the screen layout changes. Only apply initial and apply now makes sense for the screen rule. If you want dynamic actions use a script instead.
Comment 2 Ismael Asensio 2022-01-28 21:21:13 UTC
*** Bug 447488 has been marked as a duplicate of this bug. ***
Comment 3 Ismael Asensio 2022-04-16 16:28:09 UTC
Git commit 75d71a1c1a0b837757fd1a5f687bfb98c9907bc6 by Ismael Asensio.
Committed on 16/04/2022 at 16:02.
Pushed by iasensio into branch 'master'.

AbstractClient: Re-check screen rules on screen enabled
FIXED-IN: 5.25

M  +0    -1    autotests/integration/xdgshellclient_rules_test.cpp
M  +5    -0    src/workspace.cpp