mirror of
https://github.com/robotn/gohook.git
synced 2025-04-28 14:59:57 +08:00
35 lines
983 B
Markdown
35 lines
983 B
Markdown
# ghook (gohook fork)
|
|
|
|
[](https://circleci.com/gh/cauefcr/ghook)
|
|

|
|
[](https://goreportcard.com/report/github.com/cauefcr/ghook)
|
|
[](https://godoc.org/github.com/cauefcr/ghook)
|
|
<!-- This is a work in progress. -->
|
|
|
|
Based on [libuiohook](https://github.com/kwhat/libuiohook)
|
|
|
|
```Go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
//"github.com/robotn/gohook"
|
|
"github.com/cauefcr/ghook"
|
|
)
|
|
|
|
func main() {
|
|
EvChan := hook.Start()
|
|
defer hook.End()
|
|
// drawing := false
|
|
|
|
hook.Register(hook.KeyDown, []string{"alt", "p"}, func(e hook.Event) {
|
|
fmt.Println("alt-p ", e)
|
|
})
|
|
|
|
hook.Register(hook.KeyDown, []string{}, func(e hook.Event) {
|
|
fmt.Println(e.Keycode)
|
|
})
|
|
|
|
<-hook.Process(EvChan)
|
|
}
|
|
``` |