#!/bin/bash ###Config Section### TIME=300 PATH2="$HOME"/.e/e ###End Section### match() { actualresolution=`xdpyinfo | grep dimension | awk '{print $2}'` CUR=`enlightenment_remote -default-bg-get | grep REPLY: | awk '{print $2}' | tr -d '"'` edje_thumb "$CUR" e/desktop/background "$HOME"/.e/e/bg-jpg/tmp.png -g $actualresolution -og $actualresolution Esetroot -mirror "$HOME"/.e/e/bg-jpg/tmp.png exit } stop() { stp=0 if [ -e "$HOME"/.bgchanger.pid ] then echo "Stopping BG-changer...." pid=`cat $HOME/.bgchanger.pid` for item in $pid; do kill $item done rm "$HOME"/.bgchanger.pid else echo "No pid file was found... nothing to kill. Exiting" fi exit } loop() { echo "starting E17 background changer" echo $$ >>"$HOME"/.bgchanger.pid PATH2="$HOME"/.e/e/backgrounds if [ -e "$PATH2"/../bg-jpg/ ] then echo ""$PATH2"/../bg-jgp already exists"; else mkdir "$HOME"/.e/e/bg-jpg ; echo "created "$PATH2"/bg-jgp"; fi cd "$PATH2" actualresolution=`xdpyinfo | grep dimension | awk '{print $2}'` while :; do for i in *.edj do sleep "$TIME" if ! pgrep enlightenment &> /dev/null # if ! pgrep xterm then stop fi #echo "$i" if ! [ -e "$HOME"/.e/e/bg-jpg/"$i".png ] then edje_thumb "$i" e/desktop/background "$HOME"/.e/e/bg-jpg/"$i".png -g $actualresolution -og $actualresolution fi #echo "$PATH2"/"$i" enlightenment_remote -default-bg-set "$PATH2"/"$i" Esetroot -mirror "$HOME"/.e/e/bg-jpg/"$i".png done done } #i=fork (); #if (i<0) exit(1); /* fork error */ #if (i>0) exit(0); /* parent exits */ #/* child (daemon) continues */ exec2() { nohup ./bgchanger.sh start2 &> /dev/null & #cat nohup.out echo Starting bgchanger...... exit } case "$1" in stop) stop ;; start) exec2 ;; start2) loop ;; match) match ;; -f) Esetroot -mirror "$2" exit ;; esac echo "Options: " echo "" echo " start --- start bgchanger" echo " stop --- stop bgchanger" echo " match --- match the root window to the dekstop background" echo " -f --- specify a certain file for the root window" echo "Examples:" echo "" echo " ./bg-changer.sh start" echo " ./bg-changer.sh -f ~/images/background.jpg" echo "" echo "You can change the time between background changes in " echo "the config section of the script(time is in seconds)"