I want to take screenshots simultaneously from multiple X servers on one desktop PC.
I have multiple users logged in different terminals (tty1, tty2, tty3, tty4) who start multiple Xservers with startx /usr/bin/openbox-session -- :1 (and :2, :3, :4 respectively). So I can access each one of them with Ctrl+Alt+F8, +F9, +F10, +F11.
There is only one monitor on that desktop.
I want to take screenshots for each of these X servers, preferably with scrot, but I currently get a black/blank image whenever I try it. Only when I am active on that X server I get a proper screenshot.
For example, if I am on Ctrl+Alt+F8 and run scrot test.png I get a proper screenshot; if I understand correctly I do not have to set the $DISPLAY, since being on Ctrl+Alt+F8 I get echo $DISPLAY > :1. But if I run sleep 10; scrot test.png and go to Ctrl+Alt+F7, then I get a black image.
How can I get multiple screenshots from each one of those terminals simultaneously?
What worked for me was Xephyr. The only problem with this solution seems to be that when I run extremely fast xdotool commands it is not as responsive as X.
For future reference, what I did for every of the four users and terminals was:
In ~/.profile, I set each user to auto-login after my system boot, like:
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
sleep 30 # for some reason it crashes if I do not let
# it sleep for a while, not necessarily so long.
# I guess it has to do with my "normal" X at DISPLAY=:0 .
# Thus for tty2 I let it sleep 40 seconds,
# for tty3 50 seconds and so on.
startx
fi
In ~/.Xsession, I start an Xserver/client (with blackbox) and Xephyr (with openbox) in it like:
Xephyr -fullscreen -screen 1920x1200 :11 &
exec blackbox &
sleep 3 # Perhaps sleeping is redundant.
DISPLAY=:11 /usr/bin/openbox-session
I want the "final" window manager do be openbox-session. I would like to use openbox for both the Xserver and Xephyr, but exec openbox & DISPLAY=:11 /usr/bin/openbox-session crashes, while exec openbox & DISPLAY=:11 /usr/bin/openbox does not.
This way, the user in :11 can take screenshot, while the monitor shows :0. (or :13, :14, etc.).
I did not try XVnc, but I have the feeling that it might be slower than Xephyr; please correct me if I am wrong.