octalmage / robotjs

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

getPixelColor and colorAt not working on Ubuntu 22 #730

Closed meisken closed 1 year ago

meisken commented 1 year ago

Expected Behavior

Show the color hex value

Current Behavior

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  73 (X_GetImage)
  Serial number of failed request:  7
  Current serial number in output stream:  7

Steps to Reproduce (for bugs)

const mousePos = robot.getMousePos();
const pixelColor = robot.getPixelColor(mousePos.x , mousePos.y) ;
console.log(pixelColor);

Context

I just install Robotjs and try it on Ubuntu which is on Virtual Machine. This code works on windows.

Your Environment

s1hofmann commented 1 year ago

I’m pretty sure you’re running Wayland, which is not supported. Try switching to XWayland on your login screen.

meisken commented 1 year ago

Thank you so much!!!!!!!! It works after I switch to "Ubuntu on Xorg"