-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hard-coded keyboard shortcuts #2
Comments
(First off, thanks for this library - it looks great!) I believe this issue is describing what I was looking for. In my app, I need to be able to say:
I can't see a way to implement that with the current I can see that the API lets me construct a
However, I can't do anything with this shortcut, so I'm not sure why it's available in the API at the moment. I'm considering hacking around this by reading and writing to I'm happy to work on the implementation, assuming I've understood correctly so far. |
Aha, 5 minutes later, I stumbled on this merged PR which does exactly what I needed: #13 It's not documented, though. I can update the docs, if you wish. |
It is documented: https://sindresorhus.com/KeyboardShortcuts/Enums/KeyboardShortcuts/Name.html#/s:17KeyboardShortcutsAAO4NameV_7defaultADSS_AB8ShortcutVSgtcfc |
Keep this in mind though:
|
@sindresorhus ah, yes, I meant the README, which is the main place I was looking 😳 The warning makes sense. In my case, I'm migrating existing behavior, and the app is session-based rather than a long-lived menu bar app, which I think makes it less annoying. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi @sindresorhus! Thanks! |
Sometimes you need to add hard-coded keyboard shortcuts. Would be useful to add an API for that.
It could be an overload to
onKeyUp
/onKeyDown
that accepts aKey
andNSEvent.ModifierFlags
.Alternatively, it could just support a
KeyboardShortcuts.Shortcut
type directly:We should document that devs should prefer to let users customize the shortcuts instead.
Feedback wanted.
The text was updated successfully, but these errors were encountered: