Hey,
I really approciate for this package, but I would like to see the following fix in the release.
I was need to fork the repository and use npm link to reach this fix, but I would like to keep updated this package in the future.
Best regards,
Richard
https://github.com/octalmage/robotjs/blob/master/src/keypress.c#L17
#if defined(IS_WINDOWS)
#define WIN32_KEY_EVENT_WAIT(key, flags) \
(win32KeyEvent(key, flags), Sleep(DEADBEEF_RANDRANGE(63, 125)))
#elif defined(USE_X11)
#define X_KEY_EVENT(display, key, is_press) \
(XTestFakeKeyEvent(display, \
XKeysymToKeycode(display, key), \
is_press, CurrentTime), \
XSync(display, false))
#define X_KEY_EVENT_WAIT(display, key, is_press) \
(X_KEY_EVENT(display, key, is_press), \
microsleep(DEADBEEF_UNIFORM(62.5, 125.0)))
#endif
tapKey uses toggleKeyCode which calls WIN32_KEY_EVENT_WAIT once for a key and twice for a key with modifiers and therefore it can generate an additional delay of max 250ms.
i dunno why there is a extra sleep call. i forked the repository and removed it and it works fine.
< 2ms per call instead of 300ms +
_Originally posted by @Kyusung4698 in https://github.com/octalmage/robotjs/issues/530#issuecomment-570795846_
If you install with npm i git+https://github.com/octalmage/robotjs instead of npm i robotjs the issue is bypassed.
Thank you, it's a good idea!
Most helpful comment
If you install with
npm i git+https://github.com/octalmage/robotjsinstead ofnpm i robotjsthe issue is bypassed.