Override keyboard input
- Robotgo version (or commit ref): v0.100.10
- Go version: 1.17.5
- Gcc version: 11.1.0
- Operating system and bit: Linux x64
- Resolution: 1680x1050
- Can you reproduce the bug at Examples:
- [ ] Yes (provide example code)
- [ ] No
- [+] Not relevant
Is it possible to override keyboard input so that the original input is cancelled? For example : I have an EventHook that captures a press of the "w" key and then taps the "q" key. I would like to prevent the original input from being applied. Normally if you were to type w with that code running you would see "wq" appear but I am looking for a way to stop the original input from going through.
Relevant suggestion.
At the moment I am only thinking of using SetWindowsHookExA and WH_KEYBOARD_LL callback manually
now this repo dont support this, but the underwood lib uiohook support prevent event propagation by set event.reserved = 1
this need to refactor the wrap of uiohook, now code use chan string to pass event from go side to c code, so event if you set
the event.Reserved = 1 , it has no effect, need a pr to fix this. and the uiohook lib original support this feature in windows and
macos , not support x11, maybe it will support x11 and wayland in 1.3 by evdev. you can read the two link for more details
https://github.com/go-vgo/robotgo/issues/525
https://github.com/robotn/gohook/issues/16 prevent father propogation
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"`
}