I had a problem. I had a lot of nice pictures I thought would be good for a wallpaper but I was too lazy to change it manually with something else regularly. This is because I don't use a "mainstream" window manager with some utility that would do that automatically. But after searching a bit, I rejoiced. Without further ado, code:


case hostname in


if [ ! -d "$tmppath" ]
mkdir "$tmppath"
rm "$tmppath"/


filename=find $HOME/perso/Wallpapers/ -type f | shuf -n 1
fileonly=basename "$filename"
radix=echo "$fileonly" | sed -e 's/\\.[a-zA-Z]\\+$//'


nice convert \
\( \( "$filename" -gravity Center -crop "80x80%%+0+0" \
-resize "$width"x +repage -crop "$width"x"$height"+0+0 \
-resize x"$height" +repage -crop "$width"x"$height"+0+0 \
-blur 0x40 +repage \) \
\( "$filename" -resize "$width"x"$height" -matte \
-background black -shadow 100x16 \) \
-gravity Center -composite \) \
\( "$filename" -resize "$width"x"$height" \) \
-composite -flatten +repage -strip -quality 80 "$output"

display -window root "$output"

This scripts checks the host to get an idea of what resolution might the active one, sets up a temporary directory in /tmp, randomly shuffles through a directory where there are only pictures, converts a chosen picture to the desired resolution with nice blurring effects if the ratio is different and finally displays it. The code for converting is not done by me, by the way, but I can't find the original author.

Then I put the following in my crontab (assuming the script is called my-wallpaper.sh and put in the mentioned directory:

0 * * * * env DISPLAY=:0.0 $HOME/usr/bin/my-wallpaper.sh

Then I have a wallpaper that changes every hour. Bonus point: as the basename of the file is kept in /tmp, if I decide I do not like the wallpaper I can look for it in my pictures directory and remove it. Hence with time my pictures directory will only contain pictures that I deem worthy of my monitor's background.