golang-design/hotkey

Question: Can other keys be used apart from the ones that hardcoded in library?

Closed this issue · 6 comments

As subject goes, can we use other keys to listen for - for example, Alt (Linux / Windows) and Space ?
I tried to pass the key code myself instead of key.KeyS for example, but got an error about integer overflow, which is expected.
For example, when tried to use Alt from the keysymdef.h file

#define XK_Alt_L                         0xffe9  /* Left alt */

and passing it down to hotkey.New(), you get the error about int overflow
image
because

type Key uint8

What is the reason for this limitation and would it be possible to workaround / change it?

Thanks for the library!

I think this is resolved on main branch. Can you try to use the latest commit from the main branch?

ah nice! thanks, I will give it a go and let you know

If this works, I'll release a new version so that you can use a tagged version.

Great stuff, this works nicely, you can do a tagged version release I guess :)

Is there an out of the box way to listen for keyboard events in a sequence, rather than combo? Like double press on Alt, for example - this is not a blocking point, just curious
Thanks!

I just released v0.4.0: https://github.com/golang-design/hotkey/releases/tag/v0.4.0

If you are developing a GUI application, I think most GUI frameworks offer the ability to listen to keystroke events, which seems a bit necessary to provide a standalone package.
You may want to check these projects: fyne.io, gioui.org, ebiten.org

Thank you for the release, much appreciated!
I am working wails.io app, there no global listeners yet, but we can work it out :)
Thanks again!