- Code: Select all
cd /usr/local/dmenu/wallpaper
#change the above line to where ever you store your wallpaper
COUNT=`ls *.png -l | wc -l`
FILES=`ls *.png`
let SELECT=$RANDOM%$COUNT
echo "Selecting File Index " $SELECT "From " $COUNT "Files"
ctr0=0
for F in $FILES; do
if [ $ctr0 -eq $SELECT ]; then
RANDOMFILE=$F
echo "found it!"
fi
let ctr0=$ctr0+1
done
echo "File selected is " $RANDOMFILE
#change this line below to point to where ever your default wallpaper is
cp $RANDOMFILE wallpaper.png
I put mine in a file (like random.sh) and execute it the main script in the sbin folder before it loads the menu up.