Skip to content

Commit

Permalink
Don't allow “shift” key without other modifiers or function key
Browse files Browse the repository at this point in the history
Fixes #54
  • Loading branch information
sindresorhus committed Sep 11, 2021
1 parent 52b5666 commit 7030a2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/KeyboardShortcuts/RecorderCocoa.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ extension KeyboardShortcuts {
return nil
}

// The “shift” key is not allowed without other modifiers or a function key, since it doesn't actually work.
guard
!event.modifiers.isEmpty
!event.modifiers.subtracting(.shift).isEmpty
|| event.specialKey?.isFunctionKey == true,
let shortcut = Shortcut(event: event)
else {
Expand Down

0 comments on commit 7030a2e

Please sign in to comment.