Open gavin1818 opened 1 month ago
The tagline for the project is:
Custom global keyboard shortcuts for your macOS app
Handling local shortcuts is a non-goal.
However, when https://github.com/sindresorhus/KeyboardShortcuts/issues/164 is done, you could use the recorder from this package, store the keyboard shortcut yourself in UserDefaults, and then use the SwiftUI .keyboardShortcut()
method.
This is a terrible, terrible hack, but it works for me.
.keyboardShortcut()
helper here: https://github.com/sindresorhus/KeyboardShortcuts/issues/101#issuecomment-1325196892
Description
First of all, thank you for this amazing package! It has been incredibly useful in my project. However, I have a requirement that I am hoping to get some guidance on.
I need to create keyboard shortcuts that are only active when my app is in use. I want to avoid having these shortcuts override global shortcuts or interfere with other applications. I noticed that there is a brief explanation in the readme about this, but it does not provide much detail. Could you please provide more detailed guidance or examples on how to achieve in-app specific shortcuts using this package?
Here's a summary of what I have so far:
KeyboardShortcuts.Name
extension.KeyboardShortcuts.onKeyUp
to attach the shortcuts to view components.Goal
I want to ensure that these shortcuts are only active when my app is in use and do not interfere with global shortcuts or other applications.
Questions
Thank you in advance for your assistance!