Listing 1. Random Background Script
#!/usr/bin/perl -w
# This picks a random background from
# /usr/local/lib/X11/backgrounds,
# and calls an image viewer to set it as the
# background.
# This script is released under the GPL version 2.
# Putting the picture into a sub-directory named
# max will make sure it is
# resized to take up the whole background.
# Feel free to change the directory the images are
# stored in...
$bkgddir = "/usr/lib/X11/backgrounds";
# And if you'd like to use a different viewer, set
# it here.
$xv = "/usr/bin/X11/xv -root -quit +noresetroot\
-rmode 5";
$max = " -maxpect";
srand;
$tmp = '/usr/bin/find $bkgddir/* ! -type d\
-print';
@pictures = split(/\n/,$tmp);
$picture = splice(@pictures, rand @pictures, 1);
if($picture =~ /max/) { $xv .= $max; }
'$xv $picture'