Skip to content

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

@ZeronoFreya

Description

@ZeronoFreya
  • 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)
})

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions