Bash Script to Set Random XScreensaver as background

April 10, 2007 by aaron

This short bash script will randomly select a screensaver and display it in your background window, so you can have a random screensaver background instead of having to select a particular. Obviously you will need to have Xscreensaver installed for it to work.

!/bin/bash

    files=(/usr/lib/xscreensaver/*)               # Look for files in the XScreensaver folder
    n=${#files[@]}              # For aesthetics
    "${files[RANDOM % n]}" -root & # Choose a random screensaver and execute it in the root window.
Categorized as:
comments powered by Disqus