2

I have installed xdotool on my raspbian stretch with desktop and on there, everything works fine. But I also tried to install xdotool on raspbian stretch lite and on lite I always encounter the following error:

Error: can't open display: (null)
Failed creating new xdo instance

What I have also tried: I flashed raspbian stretch lite on my SD card and installed xdotool with sudo apt-get install xdotool and tested it with the command xdotool key "1". I got the error shown above.

After that I have updated from lite to desktop with sudo apt install raspberrypi-ui-mods. Then I ran xdotool key "1" again and now it works fine.

Does someone know if my guess, that xdotool only works with gui is correct.

Or does someone know how to get xdotool on rasbian stretch lite without desktop to work?

J.Doe
  • 73
  • 6

1 Answers1

1

You can get information about xdotool with:

rpi ~$ apt show xdotool
Package: xdotool
Version: 1:3.20160805.1-3
Priority: extra
Section: x11
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Installed-Size: 104 kB
Depends: libc6 (>= 2.15), libx11-6, libxdo3 (>= 1:3.20150503.1)
Homepage: https://www.semicomplete.com/blog/projects/xdotool/
Download-Size: 50.5 kB
APT-Sources: http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages
Description: simulate (generate) X11 keyboard/mouse input events
 xdotool lets you programmatically (or manually) simulate keyboard
 input and mouse activity, move and resize windows, etc. It does this
 using X11's XTEST extension and other Xlib functions.

As you can see its from Section x11 and the Description also says that it is for X11 keyboard/mouse input events. X11 is the graphical environment on Unix. You can show what would be installed with:

rpi ~$ sudo apt --simulate install xdotool

You can install it if you omit the option --simulate. I have done it on Raspbian Lite. On the plain serial console I tried:

rpi ~$ sudo xdotool mousemove 0 0
Error: Can't open display: (null)
Failed creating new xdo instance

That is as expected. There is no window where the mouse cursor can be moved. For me, using xdotool without GUI makes no sense. Maybe you have a better usage on Raspbian Lite. Tell me.

Ingo
  • 42,961
  • 20
  • 87
  • 207