gohook icon indicating copy to clipboard operation
gohook copied to clipboard

how to solve conflict

Open Guo-Chenxu opened this issue 5 months ago • 0 comments

  • Gohook version (or commit ref): v0.41.0
  • Go version: 1.20.6
  • Gcc version: 14.1.0
  • Operating system and bit: windows 64bit
  • Resolution:
  • Can you reproduce the bug at Examples:
    • [x] Yes (provide example code)
    • [ ] No
    • [ ] Not relevant
  • Provide example code:
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)
}
  • Log gist:

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.

Guo-Chenxu avatar Sep 23 '24 14:09 Guo-Chenxu