2023-08-18 10:31:18 -07:00
2020-05-20 10:55:32 -04:00
2022-02-09 09:26:46 -08:00
2022-02-09 09:26:46 -08:00
2019-02-19 11:32:48 -04:00
2019-04-13 13:26:57 -04:00
2023-08-18 10:31:18 -07:00
2020-02-22 12:11:56 -04:00
2022-01-02 16:24:25 -04:00
2023-08-18 10:31:18 -07:00
2023-08-18 10:31:18 -07:00
2020-02-23 11:02:58 -04:00
2023-03-02 17:37:06 -08:00
2021-09-09 10:34:48 -04:00
2021-12-24 14:05:52 -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.

Languages
C 94.9%
Go 5.1%