Documentation ¶
Index ¶
- Constants
- Variables
- func AddEvent(key string) bool
- func AddEvents(key string, arr ...string) bool
- func AddMouse(btn string, x ...int16) bool
- func AddMousePos(x, y int16) bool
- func End()
- func KeychartoRawcode(kc string) uint16
- func Process(evChan <-chan Event) (out chan bool)
- func RawcodetoKeychar(r uint16) string
- func Register(when uint8, cmds []string, cb func(Event))
- func Start() chan Event
- func StopEvent()
- type Event
Constants ¶
const ( // Version get the gohook version Version = "v0.40.0.123, Sierra Nevada!" // HookEnabled honk enable status HookEnabled = 1 // iota HookDisabled = 2 KeyDown = 3 KeyHold = 4 KeyUp = 5 MouseUp = 6 MouseHold = 7 MouseDown = 8 MouseMove = 9 MouseDrag = 10 MouseWheel = 11 FakeEvent = 12 // Keychar could be v CharUndefined = 0xFFFF WheelUp = -1 WheelDown = 1 )
Variables ¶
var Keycode = keycode.Keycode
Keycode defines the robotgo hook key's code map
var MouseMap = keycode.MouseMap
MouseMap defines the robotgo hook mouse's code map
var Special = keycode.Special
Special defines the special key map
Functions ¶
func AddEvent ¶
AddEvent add event listener,
parameters for the string type, the keyboard corresponding key parameters,
mouse arguments: mleft, center, mright, wheelDown, wheelUp, wheelLeft, wheelRight.
Use "hook.AddEvents()" or "gohook" add asynchronous event listener
func AddEvents ¶ added in v0.40.0
AddEvents add global event hook
hook.AddEvents("q") hook.AddEvents("q", "ctrl") hook.AddEvents("q", "ctrl", "shift")
func AddMouse ¶ added in v0.40.0
AddMouse add mouse event hook
mouse arguments: left, center, right, wheelDown, wheelUp, wheelLeft, wheelRight.
hook.AddMouse("left") hook.AddMouse("left", 100, 100)
func AddMousePos ¶ added in v0.40.0
AddMousePos add listen mouse event pos hook
func KeychartoRawcode ¶
KeychartoRawcode key char to rawcode
Types ¶
type Event ¶
type Event struct { Kind uint8 `json:"id"` When time.Time Mask uint16 `json:"mask"` Reserved uint16 `json:"reserved"` Keycode uint16 `json:"keycode"` Rawcode uint16 `json:"rawcode"` Keychar rune `json:"keychar"` Button uint16 `json:"button"` Clicks uint16 `json:"clicks"` X int16 `json:"x"` Y int16 `json:"y"` Amount uint16 `json:"amount"` Rotation int32 `json:"rotation"` Direction uint8 `json:"direction"` }
Event Holds a system event
If it's a Keyboard event the relevant fields are: Mask, Keycode, Rawcode, and Keychar, Keychar is probably what you want.
If it's a Mouse event the relevant fields are: Button, Clicks, X, Y, Amount, Rotation and Direction