I've been working on a replacement for the KWin Rules KCM based on Kirigami Scrollviews.
This is still very WIP to be merged, but it's now in a state where the main models are working fine, altough some features are still missing, and some feedback would be highly appreciated. The code can be found on the working branch `iasensio/kcm_kwinrules`
The current KCM, dating 2004, uses a custom UI widget with ad-hoc code for each rule property (helped by C-style macros) to interact with the `Rules` object being edited.
The proposed code implements a new main model (`RulesModel`) in which rule properties are a list of `RuleItem`s, which can be enabled/disabled and configured. The code required to set-up a new rule property is now quite simpler and descriptive, by just adding a new item to the model. I think this might be handy if, for instance, KWin on Wayland may support different rule properties than in X11.
I couldn't find any mockups on this specific KCM, so I implemented the UI part to my best judgement, mimicking the old kcm when in doubt. VDG opinion is here very welcome.
Now, presenting the new KCM, there are two distinct parts:
* The rules list: It uses a Kirigami's `ScrollViewKCM` view that shows the saved kwin rules and allow to create, modify, and edit them.
BEFORE:
{F8119333}
AFTER:
{F8119324}
* The rules editor: It is also implemented as a `ScrollViewKCM` feeding from `RulesModel`. When editing a rule from the KCM, the rules editor appears as a second page. Instead of tabs, the different categories are now mapped into different headers within the list view.
BEFORE:
{F8119341} {F8119343}
AFTER:
{F8119350}
{F8119345}
{F8119354}
By default, only selected "properties" of the rule are shown, presenting a more compact view for casual simple rules. Still, there are lots of information to show and configure, so it's difficult that the UI does not feel "crowded"
A challenging question is that the rules editor has a second entry-point apart from the KCM itself. In the window menu -> `Edit Specific Window/App Properties`. Currently I have kept this part the same, inserting a `QQuickView` widget inside the `QDialog`, to keep the interface with the kwinrules code (which calls this dialog) unchanged.
As you can see, my to-do list is still quite big, but I hope to check them out soon with you help.
* BUGS
[] New Rule doesn't save the description for the first time
[] Improve KConfig integration
- Apply/Saving is buggy
- How to Reset/Cancel
* PENDING FEATURES
[] Implement rules Import and Export
[] Implement filter model
[] Detect Window Properties
[] UI to suggest/select/reject each detected property
* CODE
[X] Expose enums in the plugin
[] COMMENTS/APIDOX!!!!
[] Unit Tests
[] CMakeList.txt clean-up
[] Remove old KCM code
[] Fix QML binding loops with Kirigami components
[] InlineMessage (width)
[] KeySelector (keySequence)
* UI / USABILITY
[] VDG suggestions & improvements
[] Add translation domain to qml files (how?)
[] Accessibility / Keyboard navigation
[] Support Right-To-Left layout
[] Better icons
[] Specific icons for rule properties
[] Icons for policies (exact match, regexp.. a la Kate search bar)
[] Better layout for RuleItemDelegate (min/max/preferred size, alignment...)
[] Flat comboboxes (QQC2 style problem?)
[] More consistent rules "policy", beyond the current behaviour:
[] Use only enable check to dismiss rules
[] Is is necessary to have "Do not affect" option?
[] Instant apply for "apply now / force temporarily"