Summary: | Multi-modifier Modifier-only shortcuts | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kglobalaccel | Reporter: | Oded Arbel <oded> |
Component: | general | Assignee: | fanzhuyifan |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | butirsky, fanzhuyifan, nate |
Priority: | NOR | ||
Version: | 5.249.0 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
See Also: |
https://bugs.kde.org/show_bug.cgi?id=470257 https://bugs.kde.org/show_bug.cgi?id=470113 https://bugs.kde.org/show_bug.cgi?id=420493 https://bugs.kde.org/show_bug.cgi?id=464805 |
||
Latest Commit: | https://invent.kde.org/plasma/kglobalacceld/-/commit/d20d58d4729fd94b3373b803de89054c2e2550de | Version Fixed In: | 6.1 |
Description
Oded Arbel
2023-05-25 13:57:40 UTC
I think the problem is in kwin's `ModifierOnlyShortcuts` class. It uses `KeyEvent::modifiersRelevantForGlobalShortcuts()` - which to the best of my understanding supports detecting multiple modifiers, but it then casts it to `Qt::KeyboardModifier` which can only represent one modifier - https://invent.kde.org/plasma/kwin/-/blob/7fffe993/src/modifier_only_shortcuts.cpp#L52 Though I'm not sure that this is what the shortcuts KCM does (see https://bugs.kde.org/show_bug.cgi?id=464805#c5), it is probably still a good idea to fix this, and will likely also require changes to the config file parser at https://invent.kde.org/plasma/kwin/-/blob/7fffe993/src/options.cpp#L749 to be able to read syntax such as "ShiftControl=...". Also, I think it would be a really good idea if this mechanism would allow to distinguish between physical keys - such as using "LeftShift" instead of any "Shift". This will make a solution to bug #470257 much more useful for people with more exotic group switching shortcuts, which xkbcommon supports - but this can't be implemented while relying on `Qt::KeyboardModifier` as the underlying data atom, as it doesn't make that distinction. At this point, would you like try to fix it yourself, Oded? (In reply to Andrey from comment #2) > At this point, would you like try to fix it yourself, Oded? I can try to take a stab at it - though my free time is limited, so it will take a while. If you have any ideas as to how one might approach a requirement to identify the physical modifier key that was pressed, I would love to hear them. (In reply to Oded Arbel from comment #3) > If you have any ideas as to how one might approach a requirement to identify > the physical modifier key that was pressed, I would love to hear them. What I see Qt itself doesn't support that, so we would have to do some stuff above that.. But not all at once, I think we should do iteratively. On the other hand, if we rely on QKeySequence it might be a Qt restriction we can't actually overcome in Plasma.. But I'm not sure. A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/115 Git commit d20d58d4729fd94b3373b803de89054c2e2550de by Yifan Zhu. Committed on 20/03/2024 at 17:00. Pushed by fanzhuyifan into branch 'master'. Enhance modifier-only shortcuts Trigger modifier-only shortcuts trigger on release, and support multi-key modifier-only shortcuts, which trigger only when all the modifiers are released within some interval. Related: bug 464805 M +50 -19 src/globalshortcutsregistry.cpp M +15 -0 src/globalshortcutsregistry.h M +38 -1 src/sequencehelpers_p.cpp M +2 -0 src/sequencehelpers_p.h https://invent.kde.org/plasma/kglobalacceld/-/commit/d20d58d4729fd94b3373b803de89054c2e2550de This still needs the kguiaddons MR to be merged. Git commit ccf3d654c36ef333e1302af75233a6119aca4920 by Yifan Zhu. Committed on 27/03/2024 at 15:39. Pushed by fanzhuyifan into branch 'master'. recorder/KKeySequenceRecorderPrivate: support recording multi-key modifier-only shortcuts Multi-key modifier-only shortcuts are registered if all modifiers are released within a short interval. Pretty display the sequence in the form of Mods + Key, without repetition. M +57 -0 autotests/kkeysequencerecordertest.cpp M +2 -0 autotests/kkeysequencerecordertest.h M +63 -24 src/recorder/kkeysequencerecorder.cpp https://invent.kde.org/frameworks/kguiaddons/-/commit/ccf3d654c36ef333e1302af75233a6119aca4920 |