#!/bin/bash # Random background chooser, ajf101 6/12/2002 # Fixed [to be more generic with resolutions] by rtl101 01-OCT-2003 CSLIB=${CSLIB-/usr/cslib} BGDIR=${1-$HOME/backgrounds} i=0 for filename in $BGDIR/* do if [ -r "$filename" ] then FILES[$i]=$filename i=$(($i + 1)) fi done if [ $i -gt 0 ] then rand=$(($RANDOM % $i)) dim=$(xdpyinfo | grep "dimensions:" | cut -d' ' -f7) x=$(echo $dim | cut -d'x' -f1) ((x2=$x/2)) y=$(echo $dim | cut -d'x' -f2) if [ "$y" -gt "$x2" ]; then $CSLIB/bin/xv -root -quit -geom ${x}x${y} "${FILES[$rand]}" & else $CSLIB/bin/xv -root -quit -geom ${x2}x${y} "${FILES[$rand]}" & fi fi