I have thousands of wallpapers and I like to rotate them on a specific time 
limit.  Since E17 uses the .edj
format for wallpaper, and the slideshow module only handles .edj files as well, 
I wrote a little script to
rotate your wallpaper and store the image in a tmp folder so it won't interfere 
with .e/e/backgrounds.  You
can specify multiple directories in the script and it will randomly choose a 
wallpaper from those directories.

I know the proper thing is to modify the slideshow module, but my C is so 
rusty, I might get tetanus while
trying to modify the code.

        Chris

Here is the script in case anyone else wants it:

### Begin Script

#!/bin/bash

export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

ROTATEDELAY=300

EROMOTEPROG=/opt/e17/bin/enlightenment_remote

EDJE_CC=/opt/e17/bin/edje_cc

WORKDIR=/tmp/.rotate_wallpaper

FILELIST=$WORKDIR/.imagefiles

# Location of the directories of your image files.
IMAGEFILES="$HOME/Images/1920x1200_Wall_Wapers \
               $HOME/Images/Aircraft \
               $HOME/Images/Animals    \
               $HOME/Images/Astronomy \
               $HOME/Images/Cars \
               $HOME/Images/DigitalBlasphemy \
               $HOME/Images/Fantasy \
               $HOME/Images/LinuxWallPapers \
               $HOME/Images/Scenery \
               $HOME/Images/Sci-Fi \
               $HOME/Images/Second_Nature \
               $HOME/Images/Ships"

if [ ! -d $WORKDIR ]
then
        mkdir $WORKDIR
fi

if [ -e FILELIST ]
then
        rm -f FILELIST
fi

# Build file list
for I in $IMAGEFILES
do
        find $I -type f \( -name '*.jpg' -o -name '*.png' -o -name '*.gif' \)>> 
$FILELIST
done

# Load list of images into array and remove unneeded file.
oIFS=$IFS IFS=$'\n' LINES=($(<"$FILELIST")) IFS=$oIFS
rm $FILELIST

# Create .edc file
cat >$WORKDIR/bg.edc <<__EOF__
images{ image: "bg.img" LOSSY 100; }
collections
{
group{ name: "e/desktop/background";
       data { item: "style" "0"; }
       parts {
          part { name: "bg"; mouse_events:  0;
              description { state: "default" 0.0;
                 rel1 { relative: 0.0 0.0; offset: 0 0; }
                 rel2 { relative: 1.0  1.0; offset:   -1   -1; }
                 image { normal: "bg.img"; }
                 fill { origin { relative: 0.0 0.0; offset:   0 0; }
                    size { relative: 1.0 1.0; offset:   0 0; }
              }
            }
         }
     }
}
__EOF__


# Pick random image, set the background, and loop forever.
cd $WORKDIR
while :
do
        n=${#lin...@]}
        r=$((RANDOM % n))
        IMAGE="`echo ${LINES[r]}`"
        # Build edj file from image
        cp $IMAGE $WORKDIR/bg.img
        $EDJE_CC $@ --image_dir ./ --font_dir ./ bg.edc -o bg.edj
        EDJFILE=`basename $IMAGE`
        let LESS4=${#EDJFILE}-4
        EDJFILE="`echo $EDJFILE | cut -c 1-${LESS4}`.edj"
        mv $WORKDIR/bg.edj $WORKDIR/${EDJFILE}
        $EROMOTEPROG -default-bg-set "$WORKDIR/${EDJFILE}"
        sleep $ROTATEDELAY
        rm -f "$WORKDIR/${EDJFILE}"
done

### End Script

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
enlightenment-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to