Skip to content

Better control over SRShortcutAction triggering policy #117

Open
@Kentzo

Description

@Kentzo

Currently the shortcut is triggered either by non-modifier key-up or key-down event and additional matching is done by checking the modifier flags. It does not handle modifier-only shortcuts.

Terminology

Shortcut Sequence: sequence of key-down and key-up events from the first key-down through the last key-up
Non-Modifier Key: any other key than NSEvent.ModifierFlags
Modifier Key: any of the NSEvent.ModifierFlags keys
Active Modifier Keys: modifier keys as reported by NSEvent.modifierFlags
Shortcut Sequence Modifier Keys: modifier keys that were pressed within Shortcut Sequence but are currently up
Required Modifier Keys: modifier keys required by the shortcut

Triggering Policies

In examples bellow underscore highlights modifier key events recognized by the policy. bold highlights the key event that triggered policy recognition. strikethrough highlights keys that are ignored by the policy.

Triggered by Non-Modifier Key Down / Up

  • When Required Modifier Keys equal Active Modifier Keys:
    shift-a: shift-down-a-down/a-up
  • When Active Modifier Keys contain Required Modifier Keys:
    shift-a: shift-down-ctrl-down-a-down/a-up

Triggered by Modifier Key Down

  • When Required Modifier Keys match Active Modifier Keys exactly:
    ctrl-shift: ctrl-down-shift-down
  • When Active Modifier Keys include Required Modifier Keys:
    ctrl-shift: ctrl-down-cmd-down-shift-down

Triggered by Modifier Key Up

  • When Required Modifier Keys contain Active Modifier Keys:
    cmd-ctrl-shift: cmd-down-ctrl-down-shift-down-ctrl-up
  • When Required Modifier Keys contain Shortcut Sequence Modifier Keys:
    cmd-ctrl-shift: cmd-down-ctrl-down-cmd-up-shift-down-shift-up-ctrl-up
  • When Active Modifier Keys contain Required Modifier Keys:
    cmd-ctrl-shift: cmd-down-ctrl-down-opt-down-shift-down-ctrl-up
  • When Shortcut Sequence Modifier Keys contain Required Modifier Keys:
    cmd-ctrl-shift: cmd-down-ctrl-down-opt-down-cmd-up-shift-down-opt-up-shift-up-ctrl-up

Testimonials

@bryanforbes needs to globally handle an exact match of a modifier-only shortcut for both key down and key up.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions