Skip to content

fix: pass theme type to shortcut viewer via CLI arg - #690

Open
pppanghu77 wants to merge 1 commit into
linuxdeepin:release/eaglefrom
pppanghu77:agent/agent/aa5b9e55bcbd
Open

pppanghu77 wants to merge 1 commit into
linuxdeepin:release/eaglefrom
pppanghu77:agent/agent/aa5b9e55bcbd

Conversation

@pppanghu77

@pppanghu77 pppanghu77 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

fix: pass theme type to shortcut viewer via CLI arg

  1. Root cause: displayShortcuts() launches deepin-shortcut-viewer as a
    separate process without passing the app palette type, so the
    viewer reads system theme instead of app theme
  2. Fix: add -t=dark/-t=light to shortcutString based on
    DGuiApplicationHelper::paletteType(); viewer parses -t and calls
    setPaletteType() to override system theme
  3. Impact: shortcut viewer now follows app theme; no behavior change
    when theme param is absent (backward compatible)

Log: fix shortcut panel not following app theme

Influence:

  1. Test shortcut viewer with light system theme + dark app theme
  2. Test shortcut viewer with dark system theme + light app theme
  3. Verify shortcut viewer still works without -t parameter

fix: 修复快捷键面板未跟随应用主题的问题

  1. 根因:displayShortcuts() 启动 deepin-shortcut-viewer 为独立进程
    时未传递应用当前调色板类型,导致查看器读取系统主题而非应用主题
  2. 方案:根据 DGuiApplicationHelper::paletteType() 向快捷键查看器
    传递 -t=dark/-t=light 参数,并在查看器端解析该参数调用
    setPaletteType() 设置主题
  3. 影响:快捷键面板现在跟随应用主题;未传 -t 参数时行为不变(向后兼容)

Log: 修复快捷键面板未跟随应用主题的问题

Influence:

  1. 测试系统浅色 + 应用深色时快捷键面板显示
  2. 测试系统深色 + 应用浅色时快捷键面板显示
  3. 验证未传 -t 参数时快捷键面板仍正常工作

PMS: BUG-374339

Summary by Sourcery

Bug Fixes:

  • Ensure the shortcut viewer follows the application’s light or dark palette when launched.

1. Root cause: displayShortcuts() launches deepin-shortcut-viewer as a
   separate process without passing the app palette type, so the
   viewer reads system theme instead of app theme
2. Fix: add -t=dark/-t=light to shortcutString based on
   DGuiApplicationHelper::paletteType(); viewer parses -t and calls
   setPaletteType() to override system theme
3. Impact: shortcut viewer now follows app theme; no behavior change
   when theme param is absent (backward compatible)

Log: fix shortcut panel not following app theme

Influence:
1. Test shortcut viewer with light system theme + dark app theme
2. Test shortcut viewer with dark system theme + light app theme
3. Verify shortcut viewer still works without -t parameter

fix: 修复快捷键面板未跟随应用主题的问题

1. 根因:displayShortcuts() 启动 deepin-shortcut-viewer 为独立进程
   时未传递应用当前调色板类型,导致查看器读取系统主题而非应用主题
2. 方案:根据 DGuiApplicationHelper::paletteType() 向快捷键查看器
   传递 -t=dark/-t=light 参数,并在查看器端解析该参数调用
   setPaletteType() 设置主题
3. 影响:快捷键面板现在跟随应用主题;未传 -t 参数时行为不变(向后兼容)

Log: 修复快捷键面板未跟随应用主题的问题

Influence:
1. 测试系统浅色 + 应用深色时快捷键面板显示
2. 测试系统深色 + 应用浅色时快捷键面板显示
3. 验证未传 -t 参数时快捷键面板仍正常工作

PMS: BUG-374339
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pppanghu77

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 23, 2026

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

Reviewer's Guide

The PR makes the detached shortcut viewer follow the parent application's light or dark palette by passing an optional -t CLI argument and applying it in the viewer, while preserving existing behavior when no theme override is supplied.

Sequence diagram for themed shortcut viewer launch

sequenceDiagram
    participant App as Application
    participant Helper as DGuiApplicationHelper
    participant Process as QProcess
    participant Viewer as deepin-shortcut-viewer

    App->>App: displayShortcuts()
    App->>Helper: paletteType()
    alt DarkType
        App->>Process: startDetached(deepin-shortcut-viewer, -t=dark)
        Process->>Viewer: launch with -t=dark
        Viewer->>Viewer: setPaletteType(DarkType)
    else LightType
        App->>Process: startDetached(deepin-shortcut-viewer, -t=light)
        Process->>Viewer: launch with -t=light
        Viewer->>Viewer: setPaletteType(LightType)
    else No theme override
        App->>Process: startDetached(deepin-shortcut-viewer)
        Process->>Viewer: launch without -t
    end
Loading

File-Level Changes

Change Details Files
Propagate the application palette type when launching the shortcut viewer.
  • Read the current application palette type.
  • Append a dark or light theme CLI argument when the palette is explicitly recognized.
  • Preserve existing launch behavior for other or absent palette values.
src/widgets/window.cpp
Update the shortcut viewer to accept and apply the optional theme override.
  • Parse the -t theme argument.
  • Call setPaletteType() to override the system theme when provided.
  • Retain system-theme behavior when the argument is omitted.
Not shown in provided diff

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 reviewed your changes and they look great!


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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交在 Window::displayShortcuts() 函数中新增了主题类型检测逻辑,将当前调色板类型(Dark/Light)通过 CLI 参数 -t=dark/-t=light 传递给 deepin-shortcut-viewer 进程。代码语法正确、逻辑清晰、无安全漏洞,四维度均通过。

🔍 详细分析

1. 语法逻辑 ✅

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

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

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

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

建议: []


3. 代码性能 ✅

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

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

建议: []


4. 代码安全 🔒

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

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例


本报告由 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