Skip to content

feat(setting): 支持快捷键目标选择和预截图优化#574

Merged
lzx8589561 merged 1 commit into
ZToolsCenter:mainfrom
Particaly:feature/shortcut-target-selector
Jul 7, 2026
Merged

feat(setting): 支持快捷键目标选择和预截图优化#574
lzx8589561 merged 1 commit into
ZToolsCenter:mainfrom
Particaly:feature/shortcut-target-selector

Conversation

@Particaly

Copy link
Copy Markdown
Collaborator

resolve #536
ZTools-native-api: 关联相关提交

  • 快捷键设置统一为列表选取,视觉统一
  • 新增截图专属优化,更早抓取屏幕

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a pre-screenshot optimization feature for Windows global shortcuts, allowing screenshot-related shortcuts to pre-capture the screen frame. It extracts a shared CommandTargetSelector component, updates the shortcut database schema and APIs to support preScreenshotOptimization, and integrates native Windows shortcut listening via OptimizedShortcutManager. Additionally, it expands the supported command types to include regex, over, img, and files. Review feedback points out a potential issue with duplicate native shortcut registration when updating targets, and a TypeScript type mismatch in usePluginCommandActions.ts where the newly added command types are not supported.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


if (this.shouldUseNativeOptimizedShortcut(shortcut, preScreenshotOptimization)) {
globalShortcut.unregister(shortcut)
this.registerNativeOptimizedShortcut(shortcut)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

previousWasNativetrue 时,说明该快捷键已经通过 native 注册。如果此时因为修改目标指令而重新调用 registerGlobalShortcut,在不改变快捷键的情况下,无需再次调用 this.registerNativeOptimizedShortcut(shortcut) 进行底层注册。重复注册可能会导致 native 插件返回失败,从而导致快捷键更新失败。建议仅在 !previousWasNative 时才执行底层注册。

Suggested change
this.registerNativeOptimizedShortcut(shortcut)
if (!previousWasNative) {
this.registerNativeOptimizedShortcut(shortcut)
}

featureCode: string,
cmdName: string,
cmdType: CommandCmdType
cmdType: 'text' | 'window'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

在此次修改中,系统新增了多种指令类型(如 'regex' | 'over' | 'img' | 'files')。如果将 cmdType 限制为 'text' | 'window',将导致这些新类型的指令无法通过 usePluginCommandActions 进行禁用、启用或状态查询(会产生 TypeScript 类型错误)。建议将 cmdType 的类型定义扩展为包含所有支持的指令类型,或者直接使用项目中定义的 ShortcutsSettingCommandCmdType(或其联合类型)。此建议同样适用于该文件中的其他几处修改(第 99 行、第 109 行和第 439 行)。

    cmdType: 'text' | 'regex' | 'over' | 'img' | 'files' | 'window'

@lzx8589561 lzx8589561 merged commit 76de591 into ZToolsCenter:main Jul 7, 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