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

How to use gohook to bind right and other buttons? #40

Open
ZeronoFreya opened this issue Dec 21, 2022 · 0 comments
Open

How to use gohook to bind right and other buttons? #40

ZeronoFreya opened this issue Dec 21, 2022 · 0 comments

Comments

@ZeronoFreya
Copy link

  • Gohook version (or commit ref):
  • Go version: go1.19.1
  • Gcc version: 12.2.0 (Rev6, Built by MSYS2 project)
  • Operating system and bit: windows/amd64
  • Resolution:
  • Can you reproduce the bug at Examples:
    • Yes
  • Provide example code:
package main

import (
    "fmt"

    hook "github.com/robotn/gohook"
)

func main() {

    // out: alt-q
    hook.Register(hook.KeyDown, []string{"alt", "q"}, func(e hook.Event) {
        fmt.Println("alt-q")
    })

    // out: no output
    hook.Register(hook.KeyDown, []string{"up"}, func(e hook.Event) {
        fmt.Println("up")
    })

    // out: no output
    hook.Register(hook.KeyHold, []string{"left"}, func(e hook.Event) {
        fmt.Println("left")
    })

    // out: no output
    hook.Register(hook.KeyUp, []string{"down"}, func(e hook.Event) {
        fmt.Println("down")
    })

    s := hook.Start()
    <-hook.Process(s)
}
  • Log gist:

Description

I'm sure there is nothing wrong with the keyboard, the following code prints out the keys normally

hook.Register(hook.KeyUp, []string{}, func(e hook.Event) {
    fmt.Println(e)
})

...

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

1 participant