mirror of
https://github.com/robotn/gohook.git
synced 2025-01-18 21:56:40 +08:00
Update README.md
This commit is contained in:
parent
0fa5a96dfe
commit
a945300efa
11
README.md
11
README.md
@ -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).
|
Loading…
Reference in New Issue
Block a user