Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SAVEIFS=$IFS
- IFS=$(echo -en "\n\b")
- [[ -z $1 ]] && duration=3 || duration=$1
- [[ -z $2 ]] && transition=3 || transition=$2
- [[ -z $3 ]] && style=stretched || style=$3
- slideshowname=slideshow.xml
- imagedirectory="$PWD"
- images=($(find ~+ -maxdepth 1 -iregex ".*\(jpg\|jpeg\|png\|gif\|bmp\|webm\)$"))
- [[ -z $images ]] && echo "no images found" && exit
- numImages="${#images[@]}"
- echo "found $numImages images"
- echo '<background>' > $slideshowname
- for i in $(seq 0 $numImages); do
- echo ' <static>' >> $slideshowname
- echo " <duration>$duration</duration>" >> $slideshowname
- echo " <file>"${images[$i]}"</file>" >> $slideshowname
- echo " </static>" >> $slideshowname
- echo " <transition>" >> $slideshowname
- echo " <duration>$transition</duration>" >> $slideshowname
- echo " <from>${images[$i]}</from>" >>$slideshowname
- if [[ $i -lt $numImages-1 ]]; then
- echo " <to>${images[$i+1]}</to>" >>$slideshowname
- else
- echo " <to>${images[0]}</to>" >>$slideshowname
- echo " </transition>" >> $slideshowname
- break
- fi
- echo " </transition>" >> $slideshowname
- done
- echo '</background>' >> $slideshowname
- gsettings set org.mate.background picture-filename "$imagedirectory/$slideshowname"
- gsettings set org.mate.background picture-options $style
- IFS=$SAVEIFS
Advertisement
Comments
-
- gsetting lines written for MATE because that's what I use. Easy enough to Google the proper lines for other distros. :)
Add Comment
Please, Sign In to add comment