4

I started another X session from my current one like so:

xinit xterm -- :128

An X session starts in display :128, xterm gets run in it and everything is fine.

I switched back to screen :0 (the default), though, and tried to screencap the new display:

$ xwd -root -screen -out screencap.xwd -display :128

and the resulting file was just a big black rectangle. I also tried with imagemagick import, to no avail. What is going wrong?

  • Try using scrot. Tested here, seems to work. – Renan Aug 6 '12 at 1:14
  • How do you screencap a different display (other than the current) using scrot? I can't find it in the man page – enthdegree Aug 6 '12 at 13:13
  • DISPLAY=<display> scrot – Renan Aug 6 '12 at 15:08
2

Looks like scrot is able to do it, tested with:

xinit thunar -- :128
DISPLAY=:128 scrot

gave me a correct screenshot.

(but unfortunately, scrot has been unmaintained for quite a while)

2

It turns out that x displays blank the screen and stop redrawing once their tty loses focus, with the intention of conserving CPU time and RAM. It doesn't look like there is a way to disable this functionality.

Xvfb, 'X Virtual Framebuffer' is a special implementation that does not feature this behavior as part of it's design and purpose.

Instead of initiating a new 'normal' xsession, I ran the client software in a virtual framebuffer:

xvfb-run <client software> --server-args="-screen 0 [width]x[height]x[bitdepth]"

and screencapped like this:

xwd -root -d :99 # (the default for xvfb)

Note that this display may be harder for the user to get at since it's not tied to a terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.