Question

I want to have a button which allows the user to pick a global hotkey. I stumbled upon stackoverflow and found some ways to register a hotkey, but none which allows me to let the user pick one. Is there maybe a library for it? Or how you guys handle this?

It should look like this:

enter image description here

Was it helpful?

Solution

If you would like to use an already existing framework, Shortcut Recorder is a good one that is used often. It's pretty easy to use, and might suit your needs. You can also do this manually, as alfred has mentioned, but it's quite a bit more work this way.

OTHER TIPS

You may just create an Event Tap and register keys pressed by the user. When the callback function gets called you'll have enough information to know exactly what keys has been pressed. Then you should just update the string value.

Or, at least, that's the way I'd do it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top