Bash Script to Set Random XScreensaver as background

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.

One thought on “Bash Script to Set Random XScreensaver as background

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>