Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xdotool Fails On Raspberry Pi

I'm running retropie on my Raspberry Pi, and I want to figure out a way to use the GPIO to simulate keystrokes. Xdotool seems like my best bet, but it doesn't work locally or over ssh. When I enter xdotool key 'd' I get the error:
Error: Can't open display: (null) Failed creating new xdo instance
Every answer so far claims that to solve this issue I have to do some variation of export DISPLAY=":0" xdotool key 'd' but this doesn't do anything, it just goes to the next line. I'm pretty new to linux, so thanks in advance.

like image 330
Minecat40 Avatar asked Dec 15 '25 15:12

Minecat40


1 Answers

I stumbled across an answer that worked for me. Simply running "xauth" as Pi at the command line told me which file was being used by xauthority (/home/pi/.Xauthority in this case.)

Hope this helps

export XAUTHORITY=/home/pi/.Xauthority; export DISPLAY=:0; xdotool key Return
like image 143
ThreepE0 Avatar answered Dec 18 '25 08:12

ThreepE0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!