octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.4k stars 971 forks source link

Mouse moves in stealth mode in Linux #702

Open insiderow opened 2 years ago

insiderow commented 2 years ago

When running sine.js test script, mouse seems to be moving in stealth mode, while the mouse cursor maintains the same visual position it had before the script started running.

Expected Behavior

I should see the mouse move in a sine wave pattern.

Current Behavior

When the test script is run, the mouse stays at the same position on the screen. However, there is a stealth mouse moving around, as I can see different lines of the text on the screen change with the mouse-over effect. I also expanded the code a bit to report the position of the mouse on every move, and printed the position to the system console. I can see the mouse position change with the x.y positions reported, but I can't visualize it. When the script finishes, the mouse is still visually located on the initial location, and it moves from there, when I resume to move the mouse manually. It is as if there is a hidden mouse moving on the screen, different form the one I can see. I tried different values of the mouse delay settings in the code, up to 100, but this din't work either. Also, tried it on three versions of node in Linux rebuilt with nvm. Tested also in Windows 11, but it works without any problems in Windows.

Possible Solution

Not sure, but maybe it could be a X Window problem.

Steps to Reproduce (for bugs)

  1. npm install -g node-gyp
  2. Linux had python 2.7 and python 3 installed.
  3. Installed g++ compiler
  4. npm install robotjs
  5. node sine.js No errors reported during the install of packages or while running the script.

Context

Trying to test automation features on node.js, to integrate it with the Xenxelabs Quick Keys remote, to automate keyboard and mouse actions on a Wi-Fi Engineering software. Although the Wi-Fi software works mainly on Windows, I also want to test it in Linux for other applications.

Your Environment