#!/bin/bash SCR_WIDTH=1980 SCR_HEIGHT=1080 PADDING=50 FONT_SIZE=20 CURL="curl -s" function fail() { if [ -f ~/.bg.png ]; then feh --bg-max -B white ~/.bg.png fi exit -1; } # Test internet timeout 4 wget -q --spider http://texample.net if [ $? -ne 0 ]; then fail; fi let "SCR_WIDTH -= 2 * $PADDING" let "SCR_WIDTH /= 2" let "SCR_HEIGHT -= 2 * $PADDING" PAGE=$RANDOM; let "PAGE %= 22"; let "PAGE += 1" # Fetch list of texamples cd /tmp $CURL -o texample.html "http://texample.net/tikz/examples/all/?page=$PAGE" if [ $? -ne 0 ]; then fail; fi EXAMPLES="$(grep '^