Skip to content

fix(shortcut): prevent in-app shortcuts from being registered globally#999

Merged
tisfeng merged 1 commit intodevfrom
fix-in-app-shortcuts
Sep 28, 2025
Merged

fix(shortcut): prevent in-app shortcuts from being registered globally#999
tisfeng merged 1 commit intodevfrom
fix-in-app-shortcuts

Conversation

@tisfeng
Copy link
Copy Markdown
Owner

@tisfeng tisfeng commented Sep 28, 2025

Previously, some shortcuts intended for in-app use were incorrectly registered as system-wide hotkeys. This could lead to conflicts with other applications or system functions.

This commit refactors the shortcut management logic to clearly differentiate between global and in-app shortcuts. An explicit globalActions list has been introduced to define which actions should have global hotkeys. The binding function now verifies an action against this list before registering it with the HotKeyCenter, ensuring only designated shortcuts are active system-wide.

Bug introduced in #953

Fix #997 , #992 , #982

Previously, some shortcuts intended for in-app use were incorrectly registered as system-wide hotkeys. This could lead to conflicts with other applications or system functions.

This commit refactors the shortcut management logic to clearly differentiate between global and in-app shortcuts. An explicit `globalActions` list has been introduced to define which actions should have global hotkeys. The binding function now verifies an action against this list before registering it with the `HotKeyCenter`, ensuring only designated shortcuts are active system-wide.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where in-app shortcuts were incorrectly registered as system-wide hotkeys, causing conflicts with other applications. The solution introduces a clear distinction between global and in-app shortcuts through an explicit globalActions list and updated binding logic.

  • Introduced a globalActions list to define which shortcuts should be registered globally
  • Renamed bindingShortcutAction to bindingGlobalShortcutAction for clarity
  • Added validation to ensure only designated actions are registered as system-wide hotkeys

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ShortcutManager.swift Added globalActions list defining which shortcuts should be global
ShortcutManager+Default.swift Updated method name and added validation logic to prevent non-global shortcuts from registering system-wide
KeyHolderWrapper.swift Updated method calls to use the renamed bindingGlobalShortcutAction method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tisfeng tisfeng merged commit d1ff6b0 into dev Sep 28, 2025
5 checks passed
@tisfeng tisfeng deleted the fix-in-app-shortcuts branch September 28, 2025 16:32
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.

🐞 反馈问题:应用内快捷键 cmd + p 和 macOS 冲突(macOS26)

3 participants