Tuesday, April 24, 2012

Rotating Wallpapers in Gnome

After switching from KDE to Gnome, I am missing the rotating wallpapers feature. I am used to seeing scenes of Australia or castles of Europe changing on my desktop every now and then. This is an option built into KDE, for example, but there is no GUI option to set in Gnome.
Fortunately, there are tons of ways of doing this so it is just a matter of little scripting. One app I found while I was looking on how to set a transparent background in conky is feh. Setting a background is as simple as

feh --bg-scale /path/to/image.file

Additional options are available. To quickly generate a script that rotates the images in a given directory (recursive!), paste the code below into a shell script:


while true; do
 find ~/.wallpaper -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |
  shuf -n1 -z | xargs -0 feh --bg-scale
 sleep 15m

where "~/.wallpaper" is the location you want the script to scan.

No comments: