tint2 let's you run custom commands and if the first line that it outputs is an image path, it will display that image.
So I took this sprite sheet I found (which motivated me to do this in the first place):
View attachment 3028931
And wrote a little script that creates a composite using ImageMagick:
Bash:
#!/bin/sh
#COORDS="51.507,-0.128" # London
COORDS="40.73,73.99" # NY
SUNS="160+144 160+160 160+176 160+192 160+208 160+224 16+144 16+160 16+176 16+192 16+208 16+224 64+144 64+160 64+176 64+192 64+208 64+224 112+144 112+160 112+176 112+192 112+208 112+224"
SKIES="160+256 160+272 160+288 160+304 160+320 160+336 16+256 16+272 16+288 16+304 16+320 16+336 64+256 64+272 64+288 64+304 64+320 64+336 112+256 112+272 112+288 112+304 112+320 112+336"
HOUR="$(expr $(date +%H) + 1)"
SUN="$(echo $SUNS | cut -d " " -f $HOUR)"
SKY="$(echo $SKIES | cut -d " " -f $HOUR)"
WEATHER="$(curl -s "https://api.weather.com/v3/wx/observations/current?apiKey=e1f10a1e78da46f5b10a1e78da96f525&geocode=$COORDS&units=m&language=en-US&format=json")"
RAINY="$(echo "$WEATHER" | grep -Po "(?<=precip1Hour\":)[^\.]+")"
CLOUDS="$(echo "$WEATHER" | grep -Po "(?<=cloudCoverPhrase\":\")[^\"]+")"
#snow1Hour
#echo "$WEATHER" | grep -Po "(?<=sunriseTimeUtc\":\")[^\"]+"
#echo "$WEATHER" | grep -Po "(?<=sunsetTimeUtc\":\")[^\"]+"
#TODO lightning, moon phases
dayRedNight() {
if [ "$HOUR" -eq 7 ] || [ "$HOUR" -eq 18 ] || [ "$HOUR" -eq 19 ]; then
printf "$2"
elif [ $HOUR -gt 19 ] || [ $HOUR -lt 7 ]; then
printf "$3"
else
printf "$1"
fi
}
if [ "$CLOUDS" = "Clear" ]; then
CLOUD=160+64
elif [ "$CLOUDS" = "Partly Cloudy" ]; then
CLOUD=$(dayRedNight 0 32 64)+368
elif [ "$CLOUDS" = "Cloudy" ]; then
CLOUD=$(dayRedNight 96 128 160)+368
elif [ "$CLOUDS" = "Mostly Cloudy" ]; then
CLOUD=$(dayRedNight 0 32 64)+384
fi
if [ $RAINY -eq 0 ]; then
RAIN=160+64
elif [ $RAINY -gt 0 ]; then
if [ $HOUR -gt 19 ]; then
RAIN=112+400
else
RAIN=80+400
fi
# TODO HEAVY RAIN 16+400
fi
convert clock.png -write mpr:src +delete \
\( mpr:src -crop 32x16+$SKY \) \
\( mpr:src -crop 32x16+32+16 \) \
-composite \
\( mpr:src -crop 32x16+$SUN \) \
-composite \
\( mpr:src -crop 32x16+$CLOUD \) \
-composite \
\( mpr:src -crop 32x16+$RAIN \) \
-composite \
+write tint-clock.png null:
DIR="$(dirname "$0")"
DIR="$(cd "$DIR"; pwd)"
echo "$DIR/tint-clock.png"