sindresorhus / KeyboardShortcuts

⌨️ Add user-customizable global keyboard shortcuts (hotkeys) to your macOS app in minutes
https://swiftpackageindex.com/sindresorhus/KeyboardShortcuts/documentation/keyboardshortcuts/keyboardshortcuts
MIT License
1.99k stars 184 forks source link

Is it possible to trigger a shortcut key continuously by holding it down? #152

Open asaxing opened 11 months ago

asaxing commented 11 months ago

For Example, in a list, the shortcut key to move to the next element can be designed to move continuously downward when held down.

sindresorhus commented 11 months ago

There's nothing built-in, but you could probably use .events(for name: KeyboardShortcuts.Name) for this. If the key is down, start a timer that emits as long as the key is down, with an interval of NSEvent.keyRepeatDelay.