2007-10-09
A silly trick with X
Once upon a time, I was at home and really needed to see something that was displayed on my screen at work. This being Unix, there was no convenient remote desktop add-on that would have let me mirror my work display to home, but this being Unix, there are ways around that.
(Also, I was connecting over a slow dialup PPP connection, so a live remote desktop thing would have been difficult anyways.)
My first attempt was simple; ssh in to the work machine and do
DISPLAY=:0 xwd -out /tmp/screen.xwd
. This generated a large image
that was unfortunately full of a lot of black, because I was running
a screen locker, and the X screen locker
actually puts a real window up on top of everything on the screen,
instead of having a special side channel into X.
No problem; this is Unix and I had a hammer:
- ssh in to work
export DISPLAY=:0
- kill the xlock process
xwd
the now revealed screen, complete with the window I needed to read- run
nohup xlock >/dev/null 2>&1 </dev/null &
to re-lock my screen
(After all, xlock doesn't care exactly where it's being started from;
all it needs is a $DISPLAY
and enough privileges on the display.)
Technically I believe I didn't use xwd
, but I've now forgotten
whatever screen dump program it was. These days I would use import
from ImageMagick; however much ImageMagick makes me wince vaguely with
its swiss army chainsaw approach to life, it's convenient.