mirror of
https://github.com/robotn/gohook.git
synced 2024-12-03 19:36:54 +08:00
update godoc and example
This commit is contained in:
parent
05ca764c42
commit
4f8581a884
@ -6,14 +6,14 @@ import (
|
||||
hook "github.com/robotn/gohook"
|
||||
)
|
||||
|
||||
func addEvent() {
|
||||
func registerEvent() {
|
||||
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
|
||||
hook.Register(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
|
||||
fmt.Println("ctrl-shift-q")
|
||||
hook.End()
|
||||
})
|
||||
|
||||
fmt.Println("--- Please press w---")
|
||||
fmt.Println("--- Please press w ---")
|
||||
hook.Register(hook.KeyDown, []string{"w"}, func(e hook.Event) {
|
||||
fmt.Println("w-")
|
||||
})
|
||||
@ -54,7 +54,7 @@ func base() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
addEvent()
|
||||
registerEvent()
|
||||
|
||||
base()
|
||||
|
||||
|
4
hook.go
4
hook.go
@ -156,7 +156,7 @@ func Process(evChan <-chan Event) (out chan bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// String return hook kind string
|
||||
// String return formatted hook kind string
|
||||
func (e Event) String() string {
|
||||
switch e.Kind {
|
||||
case HookEnabled:
|
||||
@ -202,7 +202,7 @@ func (e Event) String() string {
|
||||
return fmt.Sprintf("%v - Event: {Kind: FakeEvent}", e.When)
|
||||
}
|
||||
|
||||
return "Unknown event, contact the mantainers"
|
||||
return "Unknown event, contact the mantainers."
|
||||
}
|
||||
|
||||
// RawcodetoKeychar rawcode to keychar
|
||||
|
Loading…
Reference in New Issue
Block a user