Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

Thanks!

share|improve this question
    
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 Answers 2

up vote 2 down vote accepted

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)

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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