Bug 487756

Summary: The order of window rules isn't considered until changing them.
Product: [Plasma] kwin Reporter: JT Hundley <JThundley>
Component: rulesAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: isma.af
Priority: NOR    
Version First Reported In: 6.0.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: The Window rule for the specific host.
The Window rule for every other host.
The order of my rules, the blurred one is the specific host.

Description JT Hundley 2024-05-29 18:22:56 UTC
Created attachment 169947 [details]
The Window rule for the specific host.

SUMMARY
I have 2 rules for TeamViewer remote windows: one for a specific host and then one for every host. 


STEPS TO REPRODUCE
1. Create a window rule for a window with a specific title. The "Window Title" property is Exact Match the title is "JHUNDLEY04 — TeamViewer"
2. Create a 2nd window rule with the "Window Title" property set to Substring Match "— TeamViewer"
3. Ensure that the first rule for the exact match is higher up in the list of rules so it takes priority.
4. Open the window that should trigger the first exact match window rule.

OBSERVED RESULT
The 2nd substring match rule is applied instead of the first.
If you then change the order of the rules so that you're able to click apply on the new window rules priority, the first exact match rule is properly applied. This happens even if the first rule remains above the 2nd substring match rule.


EXPECTED RESULT
I expect the first Exact Match window rule to always be applied first and consistently.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION
Comment 1 JT Hundley 2024-05-29 18:23:33 UTC
Created attachment 169948 [details]
The Window rule for every other host.
Comment 2 JT Hundley 2024-05-29 18:25:22 UTC
Created attachment 169950 [details]
The order of my rules, the blurred one is the specific host.

Moving the blurred rule to be one higher than the non-Teamviewer rule above it makes the rules apply as they should.
Comment 3 JT Hundley 2024-06-06 18:27:50 UTC
This report can be closed. I think I misunderstood how window rules are applied. Both rules apply to the window when I only wanted one to and I think window rules continue to be evaluated after a matching one is found. I fixed the situation by using a regex that matches all teamviewer windows except for the one I don't want it to.
Comment 4 Ismael Asensio 2024-06-06 19:48:31 UTC
Kinda. The order matters too. 

What it is maybe not that intuitive, but it is how it works, is that only a rule PROPERTY is applied per window
In your case I think some of the properties were only set on the more broad reg exp.

You can avoid this (and increasing the complexity of the reg exp) by using the "Do not affect" policy. This effectively blocks that property from getting evaluated further