Skip to content

Instantly share code, notes, and snippets.

@rohithreddy
Created December 17, 2013 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohithreddy/8001369 to your computer and use it in GitHub Desktop.
Save rohithreddy/8001369 to your computer and use it in GitHub Desktop.
Bash Script to Change Wallpaper
#! /bin/bash
WALLPAPERS="/path/to/wallpapers/directory"
ALIST=( `/bin/ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`/bin/cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
feh --bg-center $WALLPAPERS/${ALIST[$number]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment