Skip to content

A driver run with sudo sends no keys: "Can't open display" ​

Symptoms ​

A script that reads game memory as root and steers with xdotool prints Failed creating new xdo instance and Error: Can't open display: (null); the game gets no keys.

Cause ​

sudo resets the environment and drops DISPLAY (observed).

What to do ​

Pass it through: sudo env DISPLAY=:1 python3 follow.py ....

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.