Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!kinzler From: kinzler@iuvax.cs.indiana.edu (Stephen Kinzler) Newsgroups: comp.windows.x Subject: Re: Shell script (source for xposk(1)) Message-ID: <28278@iuvax.cs.indiana.edu> Date: 22 Oct 89 15:19:14 GMT Sender: Stephen Kinzler Lines: 107 Written by rlk@THINK.COM in news:comp.windows.x ---------- "Shell script" ---------- > Here's a shell script I wrote to set my screen background to something > interesting without having to remember all the details about where a > particular picture lives, what program needs to be run, whether a > particular file is compressed, or whatnot. Enjoy. Here's another version of something similar. If you have "jot", it'll give you a random background screen by default. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'xposk' <<'END_OF_FILE' X#! /bin/sh X Xposkdir=/install/X/poskbitmaps X X# xposk - set X root window background to a poskbitmap X# Stephen Kinzler, kinzler@iuvax.cs.indiana.edu, July 1989 X XPATH=/usr/local/bin:/usr/ucb:/bin:/usr/bin:/usr/bin/X11:/usr/new; export PATH Xcd $poskdir X Xtmp=/tmp/`basename $0`$$ Xtrap "rm -f $tmp" 0 1 2 13 15 X Xcase "$1" in X-l) ls | sed -n 's/\.xbm.*//p' # list available bitmaps X exit;; X X'') ls | grep .xbm > $tmp # pick a random bitmap X num=`jot -r 1 1 \`wc -l < $tmp\`` X set `sed -n ${num}p $tmp` .xbm Xesac # else use specified bitmap X Xset `echo "$1"*` x # expand partial bitmap names X Xcase "$1" in # handle compressed bitmaps X*.xbm.Z) zcat "$1" > $tmp && file=$tmp;; X*.xbm) file="$1" Xesac X Xtest "$file" && { X echo "$1" | sed 's/\.xbm.*//' # print bitmap name X xsetroot -bitmap "$file" # set background to bitmap X} END_OF_FILE if test 831 -ne `wc -c <'xposk'`; then echo shar: \"'xposk'\" unpacked with wrong size! fi chmod +x 'xposk' # end of 'xposk' fi if test -f 'xposk.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xposk.1'\" else echo shar: Extracting \"'xposk.1'\" \(775 characters\) sed "s/^X//" >'xposk.1' <<'END_OF_FILE' X.TH XPOSK 1 X.SH NAME Xxposk \- set X root window background to a poskbitmap X.SH SYNOPSIS X.B xposk X[ -l | bitmap ] X.SH DESCRIPTION X.I Xposk Xsets the root window of your X display to a randomly selected bitmap Xfrom The Poskanzer Bitmap Collection, Xor to any specified bitmap. XPartial bitmap names are expanded and Xthe name of the displayed bitmap is printed. XBitmaps may be in compressed format (see X.I compress(1) X). XBitmaps outside the X.I poskbitmaps Xdirectory may be specified with their absolute pathname. XWith X.I -l, xposk Xlists the available bitmaps. X.SH FILES X/install/X/poskbitmaps Poskanzer bitmap directory X.SH AUTHOR XStephen Kinzler, kinzler@iuvax.cs.indiana.edu, July 1989 X.SH "SEE ALSO" Xxsetroot(1), bitmap(1), xphoon(1), xgranite(1), X/install/X/poskbitmaps/README END_OF_FILE if test 775 -ne `wc -c <'xposk.1'`; then echo shar: \"'xposk.1'\" unpacked with wrong size! fi # end of 'xposk.1' fi echo shar: End of shell archive. exit 0