Bug 492484 - Dialog windows for applications on Wayland using a single 4K monitor have same size & position as parent windows, and unable to set separate Kwin rules per ‘Window matching’ rules settings
Summary: Dialog windows for applications on Wayland using a single 4K monitor have sam...
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: 6.1.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-01 10:31 UTC by Pieter van der Vegte
Modified: 2025-03-15 02:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pieter van der Vegte 2024-09-01 10:31:03 UTC
SUMMARY
Setting Kwin rules for size and position for any application, regardless of it being a flatpak, GTK or Qt app results in all dialog or popup windows inheriting the same size and position on the Wayland desktop. Trying to create separate window rules for the dialog windows for a different size & position compared to the parent window will either have no effect or interferes with the rules for the parent window regardless of which ‘Window matching’ rules you attempt to use.

STEPS TO REPRODUCE
1. Set 150% for the resolution for a single 4K monitor.
2. R-click on the title bar for an app, such as Okular and select 'More Actions' -> 'Configure Special Window Settings ...'
3. Leave the ‘Window matching’ rules section at their default selections: e.g. ‘Window class’ is 'Exact Match' for ‘okular org.kde.okular’ and ‘Match whole window class’ is 'Yes', with ‘Window types’ set as normal window only.
4. Add the size and position as extra Kwin rules. 
5. Close and reopen Okular to ensure that the settings are working.
6. Select 'Save As' for the open document and observe that the dialog window has the same size and position as the parent window.
7. Resize the ‘Save As’ dialog window and open the ‘Window Rules’ system settings. 
8. Choose the ‘Add new’ and then use the ‘Detect window settings’ option, clicking on the title bar for the ‘Save As’ dialog window. Add description - e.g. Okular Save As; ‘Window class’ as Exact Match for ‘org.kde.okular’; ’Match whole window class' as ‘Yes’; ‘Window types’ set to ‘Dialog Window’; ‘Window role’ as ‘Exact Match’ with the field to the right being blank by default; ‘Window title’ as ‘Exact Match’ with the field to the right pre-filled as ‘Save As - Okular’. Then also add the ‘Position’ and ‘Size’ properties and save.
9. The new window rule appears down the bottom of the list of window rules. Move it up above the rule set previously for Okular.

OBSERVED RESULT
After closing and reopening Okular the main window size and position is correct, but when choosing ‘Save As’ the dialog window again has the same size and position as the main window.

EXPECTED RESULT
The dialog window opens with the size and position that was set in the new 'Save As' window rule, smaller than the main dialog window.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
KDE Plasma Version: 6.1.4 (Wayland)
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Similar, but not the same as bug 487001 or bug 460628
Sorry, I'm not exactly sure how the different Window matching’ rules choices affect things as the ‘Help’ documentation did not explain properly for the situation of a dialog window. 
When deleting the new rule for ‘Save As’ and trying again it does not seem to matter what choices are made as no separate window rule can be created to provide a smaller window as desired. 
All dialog windows for all the applications have the same issue. Some applications such as Dolphin have their previouslyy created special window rules “corrupted” when trying to create window rules for their dialog windows, and lose their size and position settings - opening in the default 'centre' of the screen as a result.
Comment 1 wara 2024-09-03 07:50:56 UTC
You're experiencing an issue with setting KWin rules for window size and position on a Wayland desktop in KDE Plasma. When you try to create separate rules for an application's main window and its dialog windows (like the 'Save As' window in Okular), the dialog windows end up using the same size and position as the main window, which isn't what you want.

What Happened:
1. You set specific size and position rules for Okular's main window.
2. Then, you tried to set different rules for the 'Save As' dialog window.
3. Despite this, the 'Save As' dialog still opened with the same size and position as the main window.

Expected Behavior:
The dialog window should open with the smaller size and different position you set for it.
Possible Reasons:
-Rule Conflicts: The system might not be distinguishing properly between the main window and dialog windows.
- Wayland Issues: This might be a limitation or bug in how Wayland handles window rules in KDE Plasma.
Summary:
The problem might be a bug or a limitation in the current setup of KWin on Wayland. You may need to <a href="https://recipevilla.com">report</a>this to KDE developers for further help.
Comment 2 Pieter van der Vegte 2024-09-03 10:31:13 UTC
So, AI bots are now making comments on bugs.kde.org?
Comment 3 Pieter van der Vegte 2025-03-15 02:20:09 UTC
I found a way of dealing with this by deleting the rule for 'Size' and keeping just the rule for 'Position'.