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_xt and RFC review D28152
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 RuleItems, 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.
- 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.
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.
- New Rule doesn't save the description for the first time
- Improve KConfig integration
- Apply/Saving is buggy [X ] Reset/Cancel to previous state without saving
- PENDING FEATURES
- Implement rules Import and Export
- Implement filter model: search and show all
- Detect Window Properties
- INTEGRATION WITH KConfigXT (D27682)
- Rebase to KConfigXT, now on master branch
- Re-implement features on the new interface
- Directly store a list of RuleSettings instead of Rules objects
- Explore integration between KConfigXT and ManagedConfigModule(D24821)
- Tighter integration between RuleItem and RuleSettings' items (some features overlap)
- Initialize rule items using the RuleSettings schema (future)
- Expose enums in the plugin
- Unit Tests
- CMakeList.txt clean-up
- Use the current module name (kcm_kwinrules)
- Remove old KCM code
- Use RuleItem as a template, instead of custom enum Type. (might it require a distinct item to edit in some cases?)
- Fix QML binding loops
- InlineMessage.qml:241:13: QML Label: Binding loop detected for property "verticalAlignment"
- KeySelector (keySequence) (D27795)
- CoordinateEditor (RowLayout width for items)
- ScrollViewKCM.qml:73:13: QML Control: Binding loop detected for property "implicitHeight"
- Remove dependency on QDialog in kwin_rules_dialog executable
- Use a full model (RuleBookModel) instead of passing a QStringList
- Use QPersistentModelIndex to store current rule being edited
- UI / USABILITY
- VDG suggestions & improvements
- UI to suggest/select/reject each detected property
- 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?)
- EXTEND CURRENT BEHAVIOR
- Use interactive window selection for "Detect window properties" in kcm rules (T5217)
- Use only one way to disable rules (Is it necessary to have "Do not affect" option?)
- Separate "window matching" group from the rest ("which windows does it apply" vs "what to do with them")
- Add/Remove metaphor instead of select/deselect properties
- Change/expand "window class" to an application selection
- Instant apply for "apply now / force temporarily"