#!/bin/ksh -x # FILE: setbg-ksh # AUTHOR: Greg Schenzel # DESCR: This is the KornShell version of my "setbg" script. # It requires the following: # xdpyinfo(1) of X11R6 # qiv(1), image viewer # ksh(1), KornShell # bc(1), arbitrary precision calculator # awk/ls/grep/wc, standard unix tools # NOTE: Instead of depending on the random(6) bsd game, this script # depends on ksh(1) and bc(1). Therefor, it is more likely to work # on commercial unix and NetBSD/OpenBSD without "games" installed. # If you run Linux and don't have either bsdgames or ksh installed, # then you need one or the other. Debian users can apt-get the # pdksh package. IMGS='*.jpg *.png *.gif *.bmp' cd ~/backgrounds/`xdpyinfo | grep dimensions | awk '{print $2}'` COUNT=`/bin/ls ${IMGS} | wc -l` SEL=`echo ${RANDOM}%${COUNT} | bc` IMG=`/bin/ls ${IMGS} | awk '{line[NR-1] = $0} END {print line['${SEL}']}'` echo $IMG | grep .t. && TILE=true if [ -z "$TILE" ]; then qiv --bg_color "#7a8f9e" --root "$IMG" else qiv --bg_color "#7a8f9e" --root_t "$IMG" fi #wmsetbg -b \"#7a8f9e\" -e "$IMG"