键盘事件监控, from : https://github.com/robotn/gohook.git
Go to file
Laurent Demailly 0e2b0dd006
Correct order to match underlying one
Fixes #32 (maybe, need to test)
2022-02-06 01:26:39 -08:00
.github/workflows Update go.yml 2021-08-22 10:13:04 -04:00
chan update version and gomod pkg 2020-05-20 10:55:32 -04:00
event add center mouse and update code style 2019-03-05 15:29:54 -04:00
examples update godoc and example 2020-12-02 13:01:20 -04:00
hook Correct order to match underlying one 2022-02-06 01:26:39 -08:00
test add example and update code style 2019-02-19 11:32:48 -04:00
.gitignore update .gitignore 2019-04-13 13:26:57 -04:00
appveyor.yml Update README.md 2021-12-24 14:05:52 -04:00
circle.yml update circle.yml 2020-02-22 12:11:56 -04:00
event.go Move robotgo event code to event.go 2022-01-02 16:24:25 -04:00
extern.go update go send json.Unmarshal error log 2019-06-22 12:58:07 -04:00
go.mod Update keycode.go use the newest code 2021-11-23 16:19:46 -04:00
go.sum Update keycode.go use the newest code 2021-11-23 16:19:46 -04:00
hook_test.go add keycode test support 2020-02-23 11:02:58 -04:00
hook.go Move robotgo event code to event.go 2022-01-02 16:24:25 -04:00
keycode.go Update keycode.go use the newest code 2021-11-23 16:19:46 -04:00
LICENSE Changed to both two license 2021-09-09 10:34:48 -04:00
README.md Update README.md 2021-12-24 14:05:52 -04:00
tables.go add more keycodes and update appveyor.yml 2021-08-08 14:42:54 -04:00

gohook

Build Status CircleCI Status Appveyor Go Report Card GoDoc

Requirements (Linux):

Robotgo-requirements-event

Install:

With Go module support (Go 1.11+), just import:

import "github.com/robotn/gohook"

Examples:

package main

import (
	"fmt"

	hook "github.com/robotn/gohook"
)

func main() {
	add()

	low()
}

func add() {
	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---")
	hook.Register(hook.KeyDown, []string{"w"}, func(e hook.Event) {
		fmt.Println("w")
	})

	s := hook.Start()
	<-hook.Process(s)
}

func low() {
	evChan := hook.Start()
	defer hook.End()

	for ev := range evChan {
		fmt.Println("hook: ", ev)
	}
}

Based on libuiohook.