Update README.md

This commit is contained in:
vcaesar 2020-05-29 10:24:17 -04:00
parent 0fa5a96dfe
commit a945300efa

View File

@ -17,6 +17,12 @@ import (
) )
func main() { func main() {
add()
low()
}
func add() {
fmt.Println("--- Please press ctrl + shift + q to stop hook ---") fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
hook.Register(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) { hook.Register(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
fmt.Println("ctrl-shift-q") fmt.Println("ctrl-shift-q")
@ -30,14 +36,17 @@ func main() {
s := hook.Start() s := hook.Start()
<-hook.Process(s) <-hook.Process(s)
}
func low() {
EvChan := hook.Start() EvChan := hook.Start()
defer hook.End() defer hook.End()
for ev := range EvChan { for ev := range EvChan {
fmt.Println("hook: ", ev) fmt.Println("hook: ", ev)
} }
} }
``` ```
Based on [libuiohook](https://github.com/kwhat/libuiohook). Based on [libuiohook](https://github.com/kwhat/libuiohook).