5Oct/11
Randomize GNOME3 Wallpaper
Short URL for this post: http://plp.me/qpm4ABI've been looking for a simple script to randomize the display of my wallpaper on my GNOME3 desktop. After trying a few apps and not finding anything satisfying, I made my own. It's based on Dhananjay Sathe's wp-show but stripped of the GTK options dialog and some senseless redundancy.
Here it is:
#!/bin/bash # To change wallpaper automatically after N minutes, add this to your CRON (where N is minutes): N 0 * * * /path/to/wp-show base="/home/pluc/.walls/" photo=$(find $base -regex ".*\([jJ][pP][gG]\|[jJ][pP][eE][gG]\|[gG][iI][fF]\|[pP][nN][gG]\|[bB][mM][pP]\)$" -type f | while read x; do echo "`expr $RANDOM % 1000`:$x"; done | sort -n | sed 's/[0-9]*://' | head -1) uri="file://"$photo gsettings set org.gnome.desktop.background picture-uri "$uri"
