Skip to content

Instantly share code, notes, and snippets.

@mooreniemi
Created April 28, 2020 01:26
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 mooreniemi/515fa1fda37f20a62ca87672a4ad7932 to your computer and use it in GitHub Desktop.
Save mooreniemi/515fa1fda37f20a62ca87672a4ad7932 to your computer and use it in GitHub Desktop.
#! /bin/bash
# http://unix.stackexchange.com/questions/230238/starting-x-applications-from-the-terminal-and-the-warnings-that-follow
export NO_AT_BRIDGE=1
WALLPAPERS="/home/alex/Dropbox/backgrounds"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
nitrogen --set-scaled --save $WALLPAPERS/${ALIST[$number]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment