[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: script to change background in X windows?



> I'd like to have a script/program that changes the background between a 
> set of images (jpgs, pngs, etc) at either a set interval or login. Is 
> there anything like this already? I did a quick google, but found 
> nothing. I'm sure I could bash a script out to do this, but would rather 
> not if there is already something like this. Any pointers would be 
> appreciated,

set 'BG_ROOT_DIR' env var to where the pics are stored, and then write a
shell script with the following in it. This is not verified so YMMV :-)

    #!/bin/sh

    #  Pick a random file
    FILE=`perl -e '@files=glob($ENV{'BG_ROOT_DIR'} . "*"); srand(time); print $files[int(rand($#files))]'`

    #  try to use 'xv' to display it.
    xv -maxpect -root -rmode 5 -quit -norm -nc 64 $FILE && exit

    #  fallback to using xsetbg to display it.
    xsetbg -border black -fullscreen $FILE && exit

    #  add other fallback solutions here, of form "<command> $FILE && exit"

Alexis



Reply to: