Register event callbacks with Register()
masterUse Register to define a callback function that triggers when specific system events occur. You can specify the event type (e.g., KeyDown, MouseDown) and a list of command strings representing the keys or buttons that must be active for the callback to fire.
Parameters:
when(uint8): The type of event to listen for (e.g.,KeyDown,KeyUp,MouseDown,MouseMove).cmds([]string): A slice of key/button command strings. ForKeyUpevents, these are treated as the keys that must have been released.cb(func(Event)): The callback function executed when the event matches the criteria.
hook.Register(hook.KeyDown, []string{"a", "b"}, func(e hook.Event) {
fmt.Printf("Combo detected: %v\n", e)
})