Bug 451661

Summary: "Window Rules" do not save
Product: [Applications] systemsettings Reporter: Wiley Sanders <wsanders>
Component: kcm_kwinrulesAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: minor CC: isma.af, ivnitsky.a, nate, plasma-bugs-null
Priority: NOR    
Version First Reported In: 5.24.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Wiley Sanders 2022-03-18 18:16:39 UTC
"Window Rules" do not save after "Apply".



STEPS TO REPRODUCE
1. Create a Window Rule in System Settings 
2. Click "Apply"
3. Click "KWin Rules", "Task Switcher", etc settings to navigate away from "Window Rules"
4. When you return to "Window Rules", your newly created rule is gone.

OBSERVED RESULT
When you return to "Window Rules", your newly created rule is gone.

EXPECTED RESULT
When you return to "Window Rules", your newly created rule should have been saved.


SOFTWARE/OS VERSIONS
Fedora release 35 (Thirty Five)
NAME="Fedora Linux"
VERSION="35 (Thirty Five)"

(available in About System)
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Wiley Sanders 2022-03-18 18:23:55 UTC
Update: When I look at .config/kwinrulesrc, the rules are there. Dot-config directory has perms 700, files in it 600:

$ cat kwinrulesrc
[$Version]
update_info=kwinrules.upd:replace-placement-string-to-enum,kwinrules.upd:use-virtual-desktop-ids

[09f4baee-8ebe-4b0f-8ee7-d5e29dcf7a61]
Description=Oclock On Top
above=true
aboverule=5
wmclass=clock
wmclassmatch=2

[c6a04145-ec8d-484b-b12c-f3ce3cac698d]
Description=Oclock
above=true
aboverule=5
wmclass=clock
wmclassmatch=1

[c87a5e39-852c-4796-9984-e0519e08f434]
Description=oclock
above=true
aboverule=5
wmclass=clock
wmclassmatch=1
Comment 2 Ismael Asensio 2022-03-26 07:26:01 UTC
> [c87a5e39-852c-4796-9984-e0519e08f434]
> Description=oclock
> above=true
> aboverule=5
> wmclass=clock
> wmclassmatch=1

Thanks for your report! This was super-helpful. 

The rule getting deleted after it's applied is expected behaviour. The rule policy is "Apply Now", which means it's a "fire and forget". After it gets applied, it will get deleted by KWin, similar to what "Force Temporarily" does. To make the rule "stick", the policy should be "Apply initially" instead.

I know this not a very clear indication of what it does, so I'd be happy to change the text to make this more clear (to something like "Apply temporarily" and add maybe some hint like an icon. If you hover over the policy items in the combo box, the tooltips indicates the rule will be deleted after applied (while the text can also be not super clear).

The config file is actually indicating that there are no rules (there should be a "[General]" grup that list the rules for them to be picked). 
That there are still "leftovers" is actually another bug (https://bugs.kde.org/show_bug.cgi?id=446381), although it has been helpful in this case.
Comment 3 Andrei Ivnitskii 2022-06-24 07:14:46 UTC
Thank you, Ismael !
Now I understand how it works