octalmage / robotjs

Node.js Desktop Automation.

Home Page:http://robotjs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typeString (and other keyboard functions) ignore setKeyboardDelay and type slowly

slonkazoid opened this issue · comments

Expected Behavior

typeString should type at the correct speed

Current Behavior

typeString types at a very slow, inconsistent speed

Possible Solution

Using XFlush instead of XSync at https://github.com/octalmage/robotjs/blob/master/src/keypress.c#L25

Steps to Reproduce (for bugs)

robot.setKeyboardDelay(5);
console.time("type");
robot.typeString("This is a test");
console.timeEnd("type");
type: 2.776s

Context

I was just testing it and this happened

Your Environment

  • RobotJS version: 0.6.0
  • Node.js version: v16.16.0
  • npm version: 8.11.0
  • Operating System: Kubuntu 22.04

I will test the change I recommended locally, and maybe submit a PR if it works.

Yep, it works. Forking

so glad I learned X programming literally yesterday