Bug 492812

Summary: Empty window rules (with only matching conditions) get deleted
Product: [Plasma] kwin Reporter: Patrick Silva <bugseforuns>
Component: rulesAssignee: KWin default assignee <kwin-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: bugs.kde.org, isma.af, xaver.hugl
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Patrick Silva 2024-09-08 13:05:41 UTC
SUMMARY
Can reproduce on both X11 and Wayland sessions.

STEPS TO REPRODUCE
1. open Konsole
2. right-click on the window decoration, hover over 'More actions' and choose 'Configure special window settings...'  or 'Configure special application settings...' - notice that "Apply" button is activated despite nothing was changed yet
3. change anything (Description, window class (application), match whole window class, window types)
4. click on "OK" button
5. reopen the "Configure special window/application settings..." window

OBSERVED RESULT
the modification done in the step 3 was not saved

EXPECTED RESULT
any modification should be saved

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.8.0
Graphics Platform: Wayland
Comment 1 Zamundaaa 2024-09-19 20:57:34 UTC
Can confirm. It's not just that changes don't get saved, the whole window rule doesn't get saved
Comment 2 Ismael Asensio 2024-09-19 21:40:34 UTC
This was intentional according to the code. 

The RuleBook deletes "empty rules". If there is no property set, just conditions, the rule will never be matched so it serves no purpose.
For instance, temporary properties (Apply Now or Force Temporarily) aare deleted after applied, and if there's no more properties, also the whole rule gets deleted.

If we want to modify this behavior for UX purposes (some user might save the conditions and wanted to modifiy it later), we'd have to change some logic. 

The other solution is to explain this behavior in the placeholder when there are no added properties.
Comment 3 Ismael Asensio 2025-02-22 21:30:40 UTC
*** Bug 462642 has been marked as a duplicate of this bug. ***