robotn / gohook

GoHook, Go global keyboard and mouse listener hook
MIT License
324 stars 43 forks source link

how to solve conflict #55

Open Guo-Chenxu opened 1 month ago

Guo-Chenxu commented 1 month ago
package main

import (
    "fmt"

    "github.com/robotn/gohook"
)

func main() {
    fmt.Println("--- Add Event ---")
    add()
    fmt.Println("END!")
}

func add() {
    hook.Register(hook.KeyDown, []string{"ctrl", "shift", "t"}, func(e hook.Event) {
        fmt.Println("ok")
    })

    hook.Register(hook.KeyDown, []string{"ctrl", "shift", "e"}, func(e hook.Event) {
        hook.End()
    })

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

Description

hello, it works well, but i have some questions about the hot key conflict, can i make some settings to solve the conflict (let other apps ignore my operation) when i press the keys? For example, if the program above is running, when i type ctrl+shift+t in edge, i only want my program print ok, and dont want trigger the edge hot key.

Thanks for your help.