This is a simple program to change the background periodically.

It takes one or more directories with images as a parameter (no GUI) and sets a 
randomly chosen image as background. If there is a border remaining, its
color is the average color of two corners of the image. This mostly fits the 
image very well.

It doesn't work if the root-window is hidden by another program, like in Gnome or 
KDE. However, it is possible to execute a command when the image changes and 
set the background this way (for example via gconftool).
Of course this can also be used for other things, like calling a program that 
announces your new background-image on IRC. But please don't do *that*. ;)
See below for examples.


Usage:
zufall /path/to/image-directory-or-file [/path/to/image-directory-or-file]
Parameter (same as --help):
  -d, --delay=DELAY          number of seconds an image is shown (default 900)
  -s  --maxscale=PERCENT     maximum size in percent (default 150)
  -b  --minborder=PIXEL      ignore --maxscale if the remaining border would be
                             smaller than --minborder (default 100)
  -m  --minsize=KILOBYTE     only show images bigger than KILOBYTE (default 0)
                             A size of 0 shows all images

  -l  --list=FILE            load list of images from file
                             - format is one directory or file per line
                             - can also be a collection from gqview
                             - if FILE is "-", the list will be read from
                               stdin
  -S  --sequential           don't randomize the imagelist (useful with -l)
  -c  --command=COMMAND      execute COMMAND on every picture change
                               %c gets replaced with the background-color
                               %i gets replaced with the image-filename
                               %w gets replaced with the scaled width
                               %h gets replaced with the scaled height
                               %% gets replaced with %
  -n  --no-set               don't set the background
                             (but execute command if given)
  -p  --passes=PASSES        exit after given number of images

      --help                 display this help and exit
      --version              output version information and exit

SIGNALS:
  HUP                        change background
  USR1                       info
  TERM                       exit

Note that the "USR1" memory-info only prints the memory used for the pathnames.

Bind "pkill -1 zufall" to a key or put it in a launcher to change the 
background with a keypress. 



Examples:

To try out what the -c option does:
zufall /path/to/images -n -c 'echo "picture: %i  color: %c  scaled res: %wx%h"'

To append the name of the current image to a file:
zufall /path/to/images -c 'echo "%i" >> /tmp/imagehistory'

To view random images in gqview:
zufall /path/to/images -c 'gqview -r "%i"'

To get a list of files from another program (GNU-find in this case)
find /path/to/images -type f -size +512k -not -wholename '/path/to/bad/images/*' | zufall -l -

To set the background in gnome with the help of gconftool:
zufall /path/to/images -n -c '
gconftool-2 -s /desktop/gnome/background/picture_filename -t string "%i";\
gconftool-2 -s /desktop/gnome/background/primary_color -t string "%c"'

- Unfortunately there seems to be no key for scaling the image.
- I'm sure there is something similar for KDE.
- Mind the quoting, the command is executed in a shell!

Send bugreports and comments to <zufall@apfelboymchen.homeunix.net>
