#!/bin/sh

# A script to have the earth with regularly updated clouds and
# calculated areas of night and day as a desktop background

# Needs additional scripts and the file $XPHOME/xplanetrc.clouds, which
# has to include at least two lines (without # signs and with the real
# path of the cloud file):
# [earth]
# cloud_map=[path]/clouds_2048.jpg

# Xplanet homepage: http://xplanet.sourceforge.net/
# This script, and download_better.sh, can be found on http://vlado-do.de/

export XPHOME=/home/vlado/docs/xplanet
CLOUD_DOWNLOAD=$XPHOME/download_better.sh

# problems with 008 and 018!? -> that's why I convert to decimal (10#)
DAY_OF_YEAR=10#$(date +%j)
echo  "Today is day $DAY_OF_YEAR";

# europe on even days, else australia
if [ $(($DAY_OF_YEAR % 2)) == 0 ]; then
    nice -20 xplanet -hibernate 1800 -radius 42 -transparency -wait 120 -rotate -20 -latitude 20 -center +650+480 -range 4 -config $XPHOME/xplanetrc.clouds -prev_command $CLOUD_DOWNLOAD;
else
    nice -20 xplanet -wait 120 -hibernate 1800 -rotate -20 -transparency -config $XPHOME/xplanetrc.clouds -latitude -10 -longitude 110 -center +760+480 -radius 37 -range 5 -prev_command $CLOUD_DOWNLOAD;
fi


