Skip to content

feat(titlebar): 添加截图 OCR 快捷图标开关 / add screenshot OCR quick link toggle - #1252

Open
bobleer wants to merge 1 commit into
tisfeng:devfrom
bobleer:feat/screenshot-ocr-quick-link
Open

bobleer wants to merge 1 commit into
tisfeng:devfrom
bobleer:feat/screenshot-ocr-quick-link

Conversation

@bobleer

@bobleer bobleer commented Jul 25, 2026

Copy link
Copy Markdown

概述 / Summary

在快捷功能设置中新增「显示截图 OCR 快捷图标」开关。开启后,迷你窗口右上角标题栏会显示截图 OCR 图标(camera.metering.multispot),点击即可触发截图 OCR,与其他快捷图标(Google、欧路词典、苹果词典、快捷设置)行为一致。

Adds a "Show Screenshot OCR quick link icon" toggle in the shortcut function settings. When enabled, a screenshot OCR icon (camera.metering.multispot) appears in the mini window titlebar's top-right corner, clickable to trigger screenshot OCR — consistent with existing quick link icons (Google, Eudic, Apple Dictionary, Settings).

改动文件 / Changed Files

文件 File 说明
Defaults.Keys+Extension.swift 新增 showScreenshotOCRQuickLink Defaults key
MyConfiguration.swift 新增 @DefaultsWrapper 属性、Combine 观察者、@ShortcutWrapper 用于 tooltip、setter 方法
GeneralTab.swift 在快捷功能区域新增 Toggle 开关
EZTitlebar.h 新增 screenshotOCRButton 属性声明
EZTitlebar.m 新增按钮类型枚举值、按钮 lazy getter、buttonWithType: case、shortcutButtonTypes 条件分支、tooltip 分支
Localizable.xcstrings 新增 show_screenshot_ocr_quick_link 本地化 key,覆盖全部 6 种语言

实现细节 / Implementation

  • 复用现有快捷图标模式:EZTitlebarButtonType 枚举 + shortcutButtonTypes + buttonWithType: + toolTipStrWithButtonType:
  • 点击按钮调用 EZWindowManager.shared.screenshotOCR,与菜单项和快捷键触发的同一方法
  • SF Symbol 选用 camera.metering.multispot,与 ShortcutAction.swift.screenshotOCR 的 icon 一致
  • 默认值为 true,与其他快捷图标开关保持一致
  • 切换开关时通过 linkButtonUpdated 通知刷新标题栏,无需重启

验证 / Verification

代码编译通过(构建中遇到的 CocoaLumberjack 模块缓存错误和 mj_ignoredPropertyNames 冲突为仓库既有问题,与本次改动无关,已通过 stash + clean build 对比确认)。

快捷功能设置中缺少截图 OCR 的快捷入口,用户需要通过菜单才能触发截图 OCR。在迷你窗口标题栏与其他快捷图标一样提供一键入口会更方便。

在通用设置的快捷功能区域新增"显示截图 OCR 快捷图标"开关,并在标题栏添加 screenshotOCRButton。开启后标题栏右上角显示 camera.metering.multispot 图标,点击触发截图 OCR,关闭则隐藏。

用户现在可以在快捷功能中直接开启截图 OCR 快捷图标,从迷你窗口标题栏一键启动截图 OCR,与其他快捷图标行为一致。

----------------------------------------------------------------------

feat(titlebar): add screenshot OCR quick link toggle

The shortcut function settings had no quick entry for screenshot OCR, requiring users to navigate the menu to trigger it. A one-click entry in the mini window titlebar, consistent with other quick link icons, would be more convenient.

Add a "Show Screenshot OCR quick link icon" toggle in the General settings quick link section, plus a screenshotOCRButton in the titlebar. When enabled, a camera.metering.multispot icon appears in the top-right corner that triggers screenshot OCR on click; when disabled, it is hidden.

Users can now enable the screenshot OCR quick link icon from shortcut settings and launch screenshot OCR directly from the mini window titlebar, matching the behavior of other quick link icons.

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

Hello bobleer, Thank you for your first PR contribution 🎉 bobleer

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.

1 participant