Skip to content

Fix hotkey triggering logic for subset combinations and exact matching#8

Open
ChangJunPark wants to merge 2 commits into
QarthO:mainfrom
ChangJunPark:fix-exact-matching
Open

Fix hotkey triggering logic for subset combinations and exact matching#8
ChangJunPark wants to merge 2 commits into
QarthO:mainfrom
ChangJunPark:fix-exact-matching

Conversation

@ChangJunPark

Copy link
Copy Markdown

This PR includes two important improvements to the hotkey handling system:

  1. Priority-based processing: Hotkeys with more keys are processed first.
    For example, if both Cmd+C and Cmd+Shift+C are registered, pressing
    Cmd+Shift+C will only trigger the action registered for Cmd+Shift+C.

  2. Exact matching: The number of pressed keys must exactly match the number
    of registered keys for an action to be executed. This prevents unregistered
    combinations (e.g., Cmd+Alt+Shift+A) from accidentally triggering
    other actions.

Additionally, this PR adds a comprehensive test suite covering various hotkey scenarios:

  • Basic single key and modifier key combinations (Cmd+C)
  • Triple key combinations (Cmd+Shift+S)
  • Special key combinations (Shift+F1)
  • Numpad key combinations (Ctrl+Numpad1)
  • Subset hotkey behavior (Cmd+C vs Cmd+Shift+C)
  • Extra keys handling (pressing Cmd+Alt+Shift+A when only Cmd+Shift+A is registered)

These tests validate the improved behavior and ensure future changes won't break
these important use cases. The changes make qHotKeys behavior more predictable and intuitive,
better aligning with standard shortcut behavior in operating systems and applications.

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