Search: Class to allow user to select shortcut for an action

Hi there,

does anyone know for a free class, that allow users to bind a shortcut to a certain action.

Lets say I have a function and I want this function to be triggered in case user presses cmd + Key or alt + key.

But the combination should be freely selectable in settings.

Is there anything already available?

Thanks, but not what I was asking for :wink:

I already have the function triggered (exactly as described in the linked thread) using a hardcoded Key combination of

keyboard.AsyncControlKey and Keyboard.asyncKeyDown(&h10) (crtl + y) checking it in a timers action event.

What I want to do is allow the user to use a custom combination of key (any combination of ctrl, alt, shift, altgr, cmd + letter) to run the function.

So what I need is a function, that detects the wanted shortcut in a settings menue (e.g. ctrl + alt + r) and another function that detects if the custom combination is pressed in a timers action event.

If someone already has such a class and wants to share it that would be great. If not, I will do it on my own.

Thanks for any help / suggestion


Are you providing MenuItems for these actions? If so you can update the KeyboardShortcut of the MenuItem.

On Mac there’s a way to register hotkeys or use an EventTap via declares but it’s complicated, and I don’t know the equivalent for Windows or Linux. What OSes are you targeting?

No menue item and target is Windows…

I think I will provide the option in settings to select (via checkboxes) if ctrl and/or alt and/or cmd shall be used and which normal key.

I can then adjust the check in timer action event easily.

Thank s