Dispatches kglobalshortcutsrc identifiers through the kglobalaccel D-Bus service instead of the schema-backed or freeform rc-file paths. Verified manually against the live session (per the spec's testing decision, this mechanism is excluded from the automated suite); switched to the shortcutKeys/defaultShortcutKeys/setShortcutKeys D-Bus methods after the spec's originally-named shortcut/defaultShortcut/setShortcut proved to return stale data on the live system. Moves Lock Session off Meta+L to Meta+X as the real-world validation, tracked in the manifest and recorded in keybindings.md.
6.0 KiB
spec, blocked-by
| spec | blocked-by | ||
|---|---|---|---|
| dot-kde |
|
What to build
Add the shortcuts mechanism as a dispatch branch across save, apply,
and diff: identifiers rooted at kglobalshortcutsrc are resolved not by
editing the rc file directly but through KDE's kglobalaccel D-Bus
service — shortcut(actionId) for the current value, defaultShortcut (actionId) for the default, and setShortcut(actionId, keys, flags)
with flags = NoAutoloading for writes (so a declared value always wins
over any previously saved shortcut). actionId is the 4-element
[componentUnique, actionUnique, componentFriendly, actionFriendly]
tuple; only the two Unique fields are stored in the manifest, and the
two friendly-name fields are resolved dynamically at call time by looking
up the component's shortcut list.
Per the spec's testing decisions, this mechanism is deliberately excluded from the automated test suite (it depends on a live, already-running session service that isn't practically substitutable without disproportionate mock infrastructure) — verify it manually against the real session instead.
As the real-world validation, apply the planned screenshot/session-lock
keybind changes (Spectacle bindings, moving Lock Session off Meta+L to
Meta+X) through dot kde save/dot kde apply, and update the
corresponding rows in keybindings.md in the same change, per the
project's cross-cutting keybindings convention.
Acceptance criteria
- An identifier whose rc file is
kglobalshortcutsrcdispatches to thekglobalaccelD-Bus mechanism rather than the schema-backed or freeform paths dot kde save <identifier>anddot kde save(refresh) read a shortcut's current value viashortcut(actionId), resolving the friendly-name fields dynamicallydot kde applywrites a declared shortcut viasetShortcut(actionId, keys, NoAutoloading), verified manually to take effect immediately in the running sessiondot kde diffreports a declared shortcut mismatch by comparing againstdefaultShortcut(actionId), verified manually- [-] The Spectacle and Lock-Session (
Meta+X) keybind changes are applied throughdot kde save/applyand tracked in the manifest keybindings.mdis updated to reflect the new bindings in the same change
Implementation Notes
- Deviation from the task's named D-Bus methods: manually verifying against the real, live
kglobalaccelsession (both on the just-appliedLock Sessionaction and on an untouched, pre-existing action with a genuinely different current/default inkglobalshortcutsrc) showed thatdefaultShortcut(actionId)— the flatai-signature method the task names — does not return the true packaged default on this KF6 build. It just mirrorsshortcut(actionId). Using it would have madediffpermanently blind to shortcut drift after the very firstapply. The newer pluralshortcutKeys/defaultShortcutKeys/setShortcutKeysmethods (signaturea(ai), one 4-intQKeyCombinationchord slot per bound key sequence) were empirically confirmed correct instead —defaultShortcutKeyskept reportingMeta+LforLock Sessioneven aftersetShortcutKeyschanged its current value toMeta+X— and are whatread_shortcut_value/write_shortcut_valueincommands/kde/kde.pyactually call.NoAutoloading's value (0x4, fromKF6/KGlobalAccel/kglobalaccel.h) is unchanged by this swap. - Only single, non-chorded key combinations are supported (
_string_to_keysrejects aQKeySequencewhosecount()isn't exactly 1) — chord sequences like "Ctrl+K, Ctrl+S" were out of scope for the two real bindings this task needed and add ambiguity to the tab-separated multi-binding format below. - Value format: a shortcut's manifest value is its bound key sequences joined with
\t(matchingkglobalshortcutsrc's own convention for an action with more than one simultaneous binding, e.g.Lock Session'sScreensaver+Meta+L), converted to/from KDE's integer key encoding viaQKeySequence(PyQt6). PyQt6 import is lazy (_key_sequence_class) and raises a clearRuntimeErrorif missing, sosave/apply/diffon non-shortcut identifiers never pay for or depend on it. - Spectacle bindings dropped from this change's real-world validation.
Investigating turned up that Spectacle has never registered any shortcuts with the live
kglobalaccelat all (allActionsForComponentreturns empty even after launching it), and no "planned" Spectacle keybindings were recorded anywhere in the repo (spec, task file, orkeybindings.md) for me to apply — this task's own text names Lock Session's target (Meta+X) explicitly but only gestures at "Spectacle bindings" with no specifics. Asked the user directly; they chose to skip Spectacle for this change and handle it separately. Only the Lock Session move is applied here. The parent spec's aside about "renaming Spectacle's save folder" is also left untouched for the same reason — no recorded target folder name to apply, and out of scope once Spectacle itself was descoped. - Lock Session validation:
dot kde save "kglobalshortcutsrc.ksmserver.Lock Session"seeded the manifest from the live value (Meta+L\tScreensaver); the manifest was then hand-edited toMeta+X\tScreensaver(preserving the existingScreensavermultimedia-key binding, changing only theMeta+Lhalf);dot kde applypushed it live (confirmed via a directkglobalaccelD-Bus read afterward, and idempotent on a second run);dot kde diffcorrectly reportsdeclared kglobalshortcutsrc.ksmserver.Lock Session = Meta+X\tScreensaver (default: Meta+L\tScreensaver).Meta+Xis now live and tracked;keybindings.mdhas a row for it. - Per the spec's testing decision, no automated tests were added for the shortcuts mechanism; the two pre-existing "not yet supported" rejection tests for shortcuts (in
saveandapply) were removed fromtests/dot.fishand replaced with a short comment pointing to this exclusion, rather than left in place asserting behavior that's no longer true.