Skip to content

Instantly share code, notes, and snippets.

@j1cs
Last active August 29, 2015 14:17
Show Gist options
  • Save j1cs/1cd98a43f9d14fe4d264 to your computer and use it in GitHub Desktop.
Save j1cs/1cd98a43f9d14fe4d264 to your computer and use it in GitHub Desktop.
Random wallpaper
#!/bin/bash
# Reads a given directory and set a random
# wallpaper using the images on that dir.
# fluxbox wm
WALLPAPERDIR="$HOME/wallpapers"
if [[ -d "${WALLPAPERDIR}" ]]
then
while(true)
do
files=$(ls "${WALLPAPERDIR}")
file_matrix=($files)
num_files=${#file_matrix[*]}
#feh --bg-scale
fbsetbg "${WALLPAPERDIR}/${file_matrix[$((RANDOM%num_files))]}"
sleep 5m
#sleep 5s
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment