Skip to content
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

KeyUp cannot be triggered #48

Open
LuSrackhall opened this issue Jun 3, 2024 · 1 comment
Open

KeyUp cannot be triggered #48

LuSrackhall opened this issue Jun 3, 2024 · 1 comment

Comments

@LuSrackhall
Copy link

There is still a problem, KeyUp cannot be triggered, and it may be triggered incorrectly.

	hook.Register(hook.KeyUp, []string{"w"}, func(e hook.Event) {

		// fmt.Println("hook(KeyUp): ", e)

		ee, _ := json.Marshal(e)
		fmt.Println("hook(KeyUp): ", string(ee))

		fmt.Println("w")
	})

When this code is run, pressing the ‘w’ key does not produce any response. But when q, w, e are pressed quickly in succession, it enters the KeyUp callback for w. However, at this time, the keycode for e is 16 (and this number represents the event corresponding to q)."

@mfkgef
Copy link

mfkgef commented Jun 15, 2024

Temporary solution:

hook.Register(hook.KeyUp, []string{""}, func(e hook.Event) {
  if hook.RawcodetoKeychar(e.Rawcode) == "w" {
	  fmt.Println("w")
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants