Sunday, February 04, 2007

Code to Xplanet-Gnome

This code is not mine, it originally comes from this web site. Unfortunately, the web site is down. This post is only for archival purposes. Thank you, and thank open source.

#!/bin/bash
#xplanet-gnome.sh shell script v0.2
#shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night

DELAY=30m

PREFIX=/multimedia/wallpapers/
OUTPUT=xplanet.png
APPEND=2

GEOMETRY=1024x768
LONGITUDE=15
LATITUDE=30
#default is no projection,i.e. render a globe
#rectangular is the flat world map. also try ancient, azimuthal, mercator,..
#PROJECTION=rectangular

#rename background image so Gnome realises image has changed - thx to dmbasso

if [ -e "$PREFIX$OUTPUT" ]; then
rm "$PREFIX$OUTPUT"
OUTPUT="$APPEND$OUTPUT"
else
rm "$PREFIX$APPEND$OUTPUT"
fi

if [ -z $PROJECTION ]; then
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE
else
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION
fi

#update Gnome backgound
gconftool -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT"

sleep $DELAY
exec $0

No comments: