Skip to content

feat(shortcut): add custom shortcut CRUD persistence#95

Closed
yixinshark wants to merge 2 commits into
linuxdeepin:masterfrom
yixinshark:feat/shortcut-custom-crud-persistence
Closed

feat(shortcut): add custom shortcut CRUD persistence#95
yixinshark wants to merge 2 commits into
linuxdeepin:masterfrom
yixinshark:feat/shortcut-custom-crud-persistence

Conversation

@yixinshark

Copy link
Copy Markdown
Contributor

Summary

  • Add user-level DConfig persistence for runtime custom shortcuts.
  • Update ModifyCustomShortcut to write existing custom shortcut fields through a dedicated update path.
  • Remove unused conflict helper after real checks stayed on LookupConflictShortcut/registerShortcut.

Test plan

  • cmake --build dde-services/build --target plugin-dde-shortcut

Dependency

Stacked on #93. This branch is based on yixinshark:fix/shortcut-dynamic-categories, so the PR diff may include #93 until that PR is merged. Please review the top commit: 213e06a feat(shortcut): add custom shortcut CRUD and display-only support.

Expose shortcut category keys as strings, add a ListCategories D-Bus API, and return localized category display names from the shortcut service. Update DConfig shortcut categories and i18n extraction so system, window, workspace, custom, and app-provided categories are translated through the same per-app translation path.

将快捷键分类从数字枚举改为字符串键,新增 ListCategories D-Bus 接口,并由快捷键服务返回本地化后的分类显示名。同步更新 DConfig 快捷键分类和翻译提取逻辑,使系统、窗口、工作区、自定义以及应用提供的分类都走同一套按应用翻译的路径。

Log: add dynamic category metadata
Pms: BUG-367657,BUG-365993
Change-Id: I3c0440ff9a91c48b1946b228ac942973ba40c41c
Add runtime custom shortcut CRUD (AddCustomShortcut/ModifyCustomShortcut/DeleteCustomShortcut) to KeybindingManager with input validation, conflict handling and commit-failure rollback. Add GetShortcutCommand so the control center can fetch a custom shortcut command separately.

Persist runtime custom shortcuts through user-level DConfig plus a custom shortcut subpath registry. Keep Add on full save/create semantics, use updateCustomShortcut for Modify so existing entries update only changed fields, and roll back persisted state when registration or conflict persistence fails.

Introduce display-only shortcut configs so modifiable shortcuts with no hotkey remain visible as "None" after their binding is taken. Keep these entries in the runtime map and expose them through ListAllShortcuts.

Remove the unused checkConflictForConfig helper after conflict checks stayed on the actual LookupConflictShortcut/registerShortcut paths.

新增自定义快捷键运行时增删改(AddCustomShortcut/ModifyCustomShortcut/DeleteCustomShortcut),包含输入校验、冲突处理和提交失败回滚;新增 GetShortcutCommand,供控制中心单独获取自定义快捷键命令。

通过用户级 DConfig 和自定义快捷键 subpath 注册表持久化运行时自定义快捷键。Add 继续使用完整创建/保存语义,Modify 改用 updateCustomShortcut,仅更新已有条目的变化字段,并在注册或冲突持久化失败时回滚持久化状态。

引入 display-only 快捷键配置,使可修改但无热键的快捷键在绑定被其他快捷键占用后仍能以“无”显示。此类条目保留在运行时映射中,并通过 ListAllShortcuts 暴露。

删除未使用的 checkConflictForConfig 辅助函数,因为真实冲突检测仍走 LookupConflictShortcut/registerShortcut 路径。

Log: feat(shortcut): add custom shortcut CRUD and display-only support
Change-Id: Ie59dd3cb4e2575eea15974b9454eefc0ff484bfa

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yixinshark

Copy link
Copy Markdown
Contributor Author

Closing because this PR was created against master and included the previous stacked commit. Recreating it against an upstream stacked base branch so it contains only the custom shortcut persistence commit.

@yixinshark yixinshark closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants