Skip to content

fix: restore the Screensaver hardware shortcut - #203

Open
yixinshark wants to merge 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/bug-380369-screensaver-shortcut
Open

yixinshark wants to merge 1 commit into
linuxdeepin:masterfrom
yixinshark:fix/bug-380369-screensaver-shortcut

Conversation

@yixinshark

@yixinshark yixinshark commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Restore the Screensaver hardware key by registering its shortcut configuration.
  • Invoke dde-shortcut-tool power system-away through an enabled, non-modifiable system shortcut.
  • 补齐 Screensaver 硬件按键配置,调用现有离开动作。

Pms: BUG-380369

Validation

  • Screensaver JSON structure, INI registration, trigger arguments and shortcut flags validated.
  • git diff --check passed.
  • Prior review reported successful current-source Screensaver conversion probing and passing converter/catalog test binaries.
  • Live X11/Wayland activation remains unverified because the review environment had no desktop session.

Summary by Sourcery

Restore the Screensaver hardware shortcut and connect it to the existing system-away action.

New Features:

  • Restore the Screensaver hardware shortcut configuration and register it with the keybinding service.

Bug Fixes:

  • Restore Screensaver hardware-key handling by routing it through the existing system-away action.

Register the Screensaver hardware key in the shortcut configuration and route
it to dde-shortcut-tool power system-away. Keep the system shortcut enabled
and non-modifiable so the hardware key follows the existing away action.

在快捷键配置中注册 Screensaver 硬件按键,并通过 dde-shortcut-tool power
system-away 执行现有的离开动作。该系统快捷键默认启用且不可修改。

Log: restore the Screensaver hardware shortcut
Pms: BUG-380369
Change-Id: I6f32313590e156410765617f3c412773a5d6b578
@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

@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restores the Screensaver hardware key by registering a new shortcut configuration, wiring it to the existing system-away action through dde-shortcut-tool, and enforcing enabled, non-modifiable shortcut flags; structural and static validations passed, while live desktop-session activation remains unverified.

File-Level Changes

Change Details Files
Restore the Screensaver hardware shortcut by adding its shortcut definition and registering it in the built-in shortcut catalog.
  • Add the Screensaver shortcut configuration to the INI registration list.
  • Introduce the Screensaver JSON definition with the appropriate hardware-key metadata and shortcut behavior.
src/plugin-qt/shortcut/configs/org.deepin.dde.keybinding.ini
src/plugin-qt/shortcut/configs/org.deepin.dde.keybinding.shortcut.screensaver/org.deepin.shortcut.json
Route the shortcut to the existing system-away action with enforced shortcut properties.
  • Configure invocation of dde-shortcut-tool power system-away.
  • Mark the shortcut enabled and non-modifiable so the hardware key remains available and protected from user alteration.
src/plugin-qt/shortcut/configs/org.deepin.dde.keybinding.shortcut.screensaver/org.deepin.shortcut.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/plugin-qt/shortcut/configs/org.deepin.dde.keybinding.ini" line_range="33" />
<code_context>
 org.deepin.dde.keybinding.shortcut.numlock,\
 org.deepin.dde.keybinding.shortcut.pictures,\
 org.deepin.dde.keybinding.shortcut.power,\
+org.deepin.dde.keybinding.shortcut.screensaver,\
 org.deepin.dde.keybinding.shortcut.sleep,\
 org.deepin.dde.keybinding.shortcut.speechtotext,\
</code_context>
<issue_to_address>
**Lock requests fail silently**

When the X11 session manager is unavailable or rejects `RequestLock`, `PowerController::systemAway()` neither warns when the X11 session-manager interface is invalid nor checks the `RequestLock` reply, so the Screensaver key does nothing without an actionable error.

Check the X11 call result and log a warning when the interface is unavailable or the request fails.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

org.deepin.dde.keybinding.shortcut.numlock,\
org.deepin.dde.keybinding.shortcut.pictures,\
org.deepin.dde.keybinding.shortcut.power,\
org.deepin.dde.keybinding.shortcut.screensaver,\

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Lock requests fail silently

When the X11 session manager is unavailable or rejects RequestLock, PowerController::systemAway() neither warns when the X11 session-manager interface is invalid nor checks the RequestLock reply, so the Screensaver key does nothing without an actionable error.

Check the X11 call result and log a warning when the interface is unavailable or the request fails.

Prompt for AI agents
In `src/plugin-qt/shortcut/configs/org.deepin.dde.keybinding.ini` at line 33:

**Lock requests fail silently**

When the X11 session manager is unavailable or rejects `RequestLock`, `PowerController::systemAway()` neither warns when the X11 session-manager interface is invalid nor checks the `RequestLock` reply, so the Screensaver key does nothing without an actionable error.

Check the X11 call result and log a warning when the interface is unavailable or the request fails.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 96 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交旨在恢复屏幕保护(Screensaver)硬件快捷键功能,变更内容为新增快捷键配置文件及在ini配置列表中注册该快捷键。 代码语法正确、逻辑清晰,无安全漏洞。OCR审查发现2处代码质量问题(displayName中英文语义不一致、triggerType描述有误), 已扣除相应代码质量分数。总体代码质量良好,建议修正翻译与描述不一致问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 存在轻微代码质量问题,翻译与描述不一致 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ["将 name[zh_CN] 从 '锁屏' 改为 '屏保' 或 '屏幕保护',description 改为 '屏保快捷键'", "将 triggerType 的 description 从 'appId类型' 改为 '二进制command类型'"]


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 修复 displayName 中英文语义不一致及 triggerType 描述错误 // org.deepin.shortcut.json 中修改以下字段: "displayName": {
    "value": "Screen Saver",
    "serial": 0,
    "flags": [],
    "name": "displayName",
    "name[zh_CN]": "屏保",           // 修正:从 "锁屏" 改为 "屏保"
    "description": "屏保快捷键",       // 修正:从 "锁屏快捷键" 改为 "屏保快捷键"
    "permissions": "",
    "visibility": "private"
}, "triggerType": {
    "value": 1,
    "serial": 0,
    "flags": [],
    "name": "triggerType",
    "name[zh_CN]": "快捷键触发动作类型",
    "description": "二进制command类型", // 修正:从 "appId类型" 改为 "二进制command类型"
    "permissions": "",
    "visibility": "private"
}

本报告由 AI 代码审查工具自动生成

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