#! /bin/sh # name: xdumpwindow -- non-interactively dump an X11 window into a file # author: Ch. L. Spiel # last rev.: Tue Sep 18 07:54:46 UTC 2001 # Bash ver.: 2.04.0 myname=$(basename $0) function usage { cat <&2 exit 1 fi tmpfile=$(mktemp /tmp/$myname.XXXXXX) if [ $? -ne 0 ]; then echo "$myname: Cannot create temp file." 1>&2 exit 1 fi num_opts=$(expr $# - 2) if [ $num_opts -gt 0 ]; then for opt in $(seq $num_opts); do options="$options $1" shift done fi window_name="$1" output_file="$2" xwd -silent -screen -out $tmpfile -name "$window_name" convert $options xwd:$tmpfile "$output_file" /bin/rm $tmpfile exit 0