#From: Ian Kluft # #This is adapted (much more generalized now) from a script I wrote last #Wednesday to put the weather radar images in my X root window when some #thunderstorms from Hurricane Greg (off the coast of Mexico) overran the #Bay Area. # #Yeah, yeah... I know... thunderstorms are not a big deal in Central #Florida, where you get 300 days a year with at least one thunderstorm. #But we get about 5-10 a year here so it's not supposed to look like #Florida. #But it did for one night. About 10 hours after I wrote the script, #lightning struck 100 feet from my house. So use with caution. :-) # #Anyway, to use this script to put the Hurricane Floyd advisories or weather #radar in your X root window, run it in a separate shell window like this... # # ./url-bg http://www.nhc.noaa.gov/ftp/graphics/AT08/AL0899W.GIF # #or use the URL for your favorite weather radar image as the storm #approaches. #-- #Ian Kluft KO6YQ PP-ASEL Cisco Systems, #Inc. #ikluft@cisco.com (work) ikluft@thunder.sbay.org (home) San Jose, #CA # #--------------------------------------------------------------------------- #!/bin/sh # url-bg - periodically download an image from a URL to the X root window # by Ian Kluft url_get() { $lynx -source $url } to_root_win() { xsetroot case "$suffix" in gif|GIF) giftopnm | ppmtoxpm | xpmroot $stdin ;; jpg|jpeg|JPG|JPEG) djpeg -pnm | ppmtoxpm | xpmroot $stdin ;; *) print "unrecognized image type $suffix" >&2; exit 1 ;; esac } # check if OS can access fds through filesystem case `uname -sr` in "SunOS 5"*) stdin=/dev/fd/0 ;; Linux*) stdin=/proc/self/fd/0 ;; *) echo "Sorry `uname -sr` is not supported" >&2; exit 1 ;; esac # check command line url=$1 if [ ! "$url" ] then echo "usage: $0 url" >&2 exit 1 fi suffix=`echo $url | sed 's/^.*\.//'` # look for necessary commands for path in /usr/bin/lynx /usr/local/bin/lynx do if [ -x $path ] then lynx=$path break fi done for path in /usr/bin/xv /usr/local/bin/xv do if [ -x $path ] then lynx=$path break fi done # main display loop while true do url_get | to_root_win # see functions above sleep ${BG_INTERVAL:-3600} done