#!/bin/sh # # wallchanger # send bugs or suggestions to maurom1982@yahoo.com.ar WALLPAPERS=/usr/share/backgrounds TIMER= GNOME= XFCE= OPTIONS=scaled show_help() { echo "Usage: $0 [-g|-x] [-f FOLDER] [-o MODE] [-w NN]" echo echo " -g set GNOME wallpaper" echo " -x set XFCE wallpaper" echo " -f FOLDER choose from wallpapers in FOLDER" echo " -o MODE set wallpaper mode [none|wallpaper|centered|SCALED|stretched|zoom]" echo " -w NN change wallpaper every NN seconds [defaults to once]" echo exit 0; } new_wallpaper() { local CHOSEN CHOSEN=`find "$WALLPAPERS" -iname \*.jpg -print | shuf -n 1` if [ -z "$CHOSEN" ]; then echo "No wallpapers to choose from in $WALLPAPERS" exit 1 fi if [ "$GNOME" = yes ]; then gconftool-2 -s -t string /desktop/gnome/background/picture_options $OPTIONS gconftool-2 -s -t string /desktop/gnome/background/picture_filename $CHOSEN elif [ "$XFCE" = yes ]; then #xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s $OPTIONS xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $CHOSEN else show_help fi } while true; do case "$1" in -h) show_help; break ;; -g) GNOME=yes; shift ;; -x) XFCE=yes; shift ;; -f) shift; WALLPAPERS=$1; shift ;; -o) shift; OPTIONS=$1; shift ;; -w) shift; TIMER=$1; shift ;; *) break ;; esac done if [ -z "$TIMER" ]; then new_wallpaper else while true; do new_wallpaper sleep $TIMER done fi