SUMMARY: (resend) screendump for Solaris 2.4

From: Marc Hansen, Cambric Graphics (
Date: Fri Jul 07 1995 - 11:26:29 CDT

Apparently my first summary included an X-sun attachment in the middle
which caused a problem with sun mailtool. The resend follows:

Thanks for all the help Sun Managers,

I received many great ideas:

        6 people suggested using xwd (standard X utility)
        3 people suggested xgrabsc (command line version of xgrab)

        Also, a utility called xwatchwin, instructions on how to use
        screendump from SunOS 4.1 and source for screendump and the
        pixrect library.

Included below are a couple of great scripts for using xwd and the complete


Marc Hansen internet:
Cambric Graphics, Inc. vmail: (801) 298-6877
110 Business Park Drive voice: (801) 571-8100
Draper, Utah 84101 fax: (801) 571-8464

From: (Dirk Boenning)

take a look at /usr/openwin/xwd.

From: (Frode Stromsvag)

Here we have xwatchwin which we run under 4.1.3. Mybe it can
run under solaris 2.4 too?. I've attached the man page.

.TH xwatchwin 1 "17 March 1989" "X Version 11"
xwatchwin - watch a window on another X server
.B "xwatchwin"
[\-u \fIupdatetime\fP] [\-w \fIwindowID\fP] [window name]
\fIxwatchwin\fP allows you to peek at a window on another X server.
To use it, you must specify the name of the machine you want to watch, then
the name of the window on that machine. \fIXwatchwin\fP will attempt to
connect with the X server \fIhostname\fP:0.0, and if successful, will try
to retrieve a copy of the window in which you specified interest.

You may specify the window you want to watch either by name or by its
window id, usually a hexidecimal number. Usually specifying the
window by name is simpler, although not all windows have names
associated with them; in that case you must use the window id option.

If the window you want to watch is not in a viewable state,
\fIxwatchwin\fP will tell you so and exit. If while you are watching a
window it becomes 'unviewable', \fIxwatchwin\fP will print a message to
stdout and wait until the window becomes 'viewable' again.

\fIxwatchwin\fP was written as an aid to a class for people learning to
use X. The idea is that the instructor would type into an xterm
window on his/her display and the students would use \fIxwatchwin\fP to
see what the instructor typed. The students could then type the same
thing in their own terminal windows. I hope that others will find
equally (if not more) constructive uses.

.TP 8
.B \-u \fIupdatetime\fP
This option specifies how often (in seconds) you want to get a new copy
of the window you're watching. It is in effect a 'sample rate'. By default,
\fIxwatchwin\fP updates your copy of the window as often as it can. The time
it takes to actually do the update is dependent on the speed of the X server
on both machines, the speed of the intervening network, and other factors.
.TP 8
.B \-w \fIwindowID\fP
This option specifies the window you want to watch by number, for example,
"0x50000b". Use the xlswins(1) command to get a list of window id's and
possibly their names on the remote server.

You must specify a window to watch either by name or by id. Specifying
a window to watch by name is usually easier if you know what you're looking for.
If there is an X server on the remote machine "crow" and if on that server
there is a window called "X Terminal Emulator", you can watch that window
by typing

xwatchwin crow X Terminal Emulator

If there is a window on "crow" that has no name but has a window id of
"0x50000b", you can watch it by typing

xwatchwin crow -w 0x50000b

If you want to get new copies of a window only every 30 seconds, you can
do so by typing

xwatchwin crow -u 30 -w 0x50000b
xlswins(1), xwininfo(1), xdpyinfo(1),
\fIxwatchwin\fP doesn't support the \-display option. You must set the
display on which the \fIxwatchwin\fP window is created by changing your
DISPLAY environment variable.

If the window you're watching is unmapped (made 'invisible')
while \fIxwatchwin\fP
is getting a new copy of that window, the program will crash. The smaller
your update interval, the more likely you are to experience this bug (although
it hasn't happened all that often to me).

Parsing arguments is messy and not as forgiving as it should be.

The event loop is a mess.

\fIxwatchwin\fP can now deal with two displays of different depths. There
is special-case code for the conversions between 1-bit displays and 8-bit
displays (either direction) which may garble the image on some machines.
The general case code should work on anything, albeit somewhat more slowly.
One note: ABSOLUTELY no attempt is made to make the colors match up. If
you're on a 5-bit display, and you're monitoring someone elses 8-bit display,
the conversion just takes his 8 bits and chops the top 3 bits off, and puts
it on the screen. Maybe in the next version...
Copyright 1989, George D. Drapeau
George D. Drapeau
Stanford University
Academic Information Resources / Systems Development
UUCP: labrea!drapeau@jessica
Display depth conversion code added by John Bradley (

From: Ted Nolan SRI Ft Gordon <>

In message <v02110101ac17882521c5@[]> you write:

Sounds like "xgrabsc -root" is what you want.

3 caveats:

        1) You will have to have permission to access that display
            (xhost +yourhost)

        2) It will only work if X is running on that system. If they
           are not logged in and the system is at the console level,
           it won't work.

        3) I can't remember if I've ever actually tried this, and
           xgrabsc is not on my system right now..

Here's the man page. The code should be on somewhere.

                                Ted Nolan


     xgrabsc - grab rectangular screen images and store in files

     xgrabsc [-d display] [-id windowId] [-o outputFile]
             [-s seconds] [-post seconds] [-b percent]
             [-and andBits] [-or orBits] [-page widthxheight-
             hmarg-vmarg] [-bell -grab -verbose -bdrs -nobdrs
             -key -stretch -root -click -coords widthxheight+x+y
             -reverse -bw -mdither -dither -halftone
             -ps -cps -simple -xwd -xwdxy -bm -bm2 -bm3 -puzzle
             -bin -comp -eps -l -limit -preview -prev -pre-
             viewonly -colproc]

     xgrabsc lets you grab arbitrary rectangular images from an X
     server and writes them to standard output in a variety of

     Command line options also allow reduction of colormaps,
     halftoning and dithering of color images, and direct mapping
     of color images to monochrome.

     Options must be seperated with spaces or tabs. They may be
     preceded with a dash, but this optional and provided for
     Un*x addicts. Many may also be prefixed with 'no', or an
     additional dash, to turn them off.

     The default output format is gray-scale non-encapsulated
     Postscript, with image compression (if image compression
     significantly reduces the amount of output).

     If you desire an output format not produced by xgrabsc, try
     using the PBM package by Jef Poskanzer to convert xgrabsc to
     that format. PBM can read xgrabsc's XWD output and convert
     it to a lot of different formats.

                [9 more pages omited]

From: (Martin Achilli)

Try using xwd with the -root option.


Try "xwd -root -screen". Aside from a couple annoying beeps, it works
about the same as screendump.

From: (Mark Hargrave)

Here is a program that we use. Hope it helps!

#! /bin/csh -f
# Script: /mmapl/bin/xsnap
# 02-26-93 spo; created.
# Purpose: This script was designed to allow the user to view a screendump
# of another machine's monitor, when the user is running openwindows.
# ====================================
# Syntax: /mmapl/bin/xsnap
echo ""
echo "Dump will be displayed on `hostname`"
echo " =========="
echo -n "Do you wish to continue? y/n ==> "
set cont=$<
if ( $cont != "y" && $cont != "yes" ) then
goto exit
echo ""
echo ""
echo "Enter remote system name"
echo -n "==> "
set sys=$<
set osrev=`rsh $sys uname -r`
if ("$osrev" == "5.3") then
   xhost +$sys
   rsh $sys "/usr/openwin/bin/xwd -display ${sys}:0 -root -out
/usr/tmp/xsnapdump;/usr/openwin/bin/xwud -display `hostname`:0.0 -in
/usr/tmp/xsnapdump -noclick"
   rsh $sys /usr/bin/screendump > /usr/tmp/xsnapdump
   /usr/openwin/bin/snapshot -l /usr/tmp/xsnapdump

From: ( S M Margle)

>> 3.20) And what about screendump, screenload and clear_colormap?
>> You can FTP Jef's screenload, screendump, etc., if you need that
>> functionality, and for free you get a pixrect (clone) library.
>> Get one of these:
>> The 4.1.x versions of these programs will not run under
>> Solaris 2.2 or later. The pixrect BCP library is no
>> longer supported.

From: ( Duane Grant)

Try xwd to dump the remote screen, and display it with xv or xwud. The xwd
program has an -root option on our S5R4 boxes and has the standard out
option. xwud will also take the standard in, the only thing is make sure
the xhost allows you to connect to the X server.

I have some examples if you would like.


rsh -n $1 "/usr/bin/X11/xwd -root -display $DISPLAY | /usr/bsd/compress
-c" | uncompress -c | imconv -xwd - -sun - | xv -name $1 -geometry 1142x868
- &

The above is a piece out of a script we use to spy on our sgi's.

Good Luck!

From: (Steve Pryczak)

    Two solutions worked here on LPC/Sparc 2 and Sparc 20

1. The old 4.1.3 screendump command will work under Solaris 2.4.
    Just copy the binary off an old SUN OS machine. There is a
    libso archive that has to be brought over also. Just run it
    and let it bomb out - it will tell you which lib file it needs.

    what screendump:
       screendump.c 1.12 91/05/31 SMI
       screenutill.c 1.6 88/02/08 SMI

    Disadvantage of screendump & ras2ps - creates an approximately 6MB
    print file that is spooled on our report print server.

    We run it from MOTIF window menus and send it to both a HPCLJ
    and an old Tecktronix color printer.

    EX: of exec in .mwmrc ( similar statement in .openwin files )

    f.exec "screendump | ras2ps -x1.2 -y0.50 -h7.5 -l -C | lp ....."

2. xgrab (interactive like the new OPENWIN camera icon) and xgrabsc
   ( command line version good for MOTIF/openwin-menu options ) is
   available free a number of places - anonymous ftp to
   On the same printers this gives the same quality of output, with
   an approx. 2/3 reduction in print file spooled, however, it was
   much slower being processed by the HPCLJ than the raster files
   postscript output so there must be something different in the
   postscript output of both commands.

   in a .mwmrc file - whole screen color dump to postscript printer

   ex: f.exec "xgrabsc -root -cps -l -page 9.3x12.2-0.9-0.2 -sleep 1
       -post 1 | lp -d ..... > /dev/console 2>&1 "

        The sleep is so it does not take a snapshot of itself.

       There are other options for doing a user-selected window
       like xwd or xpr does.
    ( we run ksh under MOTIF for this particular option )

    Works to HPCLJ, HPCPaintJet, Tektronics Phaser III

From: Andy McCammont <>

check out the X FAQ for a list, but I like xgrab from your fav. archie
site or

From: (Al Venz)

Check out xwd and xpr, they are both in $OPENWINHOME/bin and work nicely
together to get screen or window dumps. To get the full screen try:
        xwd -root | xpr -grey 3 | lp
There are some pretty neat options if you check the man pages, nothing fancy,
but it gets your stuff to the printer.

Good luck,

P.S. When doing full screen dumps I normally don't use the -grey option or I
can't get it to fit on one page very nicely.


Marc Hansen internet:
Cambric Graphics, Inc. vmail: (801) 298-6877
110 Business Park Drive voice: (801) 571-8100
Draper, Utah 84101 fax: (801) 571-8464

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:27 CDT