Tuesday, February 06, 2007

How to customize xplanet-gnome

Ok, now you have xplanet-gnome set up. Here's how you can customize it by editing the script. We'll go through the script line by line and examine what all of the parts do. So, let's get to it.

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

These are comments about the program. It basically says you need bash shell and tells you what version and what this script does. These don't have any significance to the actual program, so we'll skip this.

[5]
DELAY=30m

This is the update interval for the script. Every 30 minutes, your desktop will be updated to the current view of the Earth. To me, this is a long time, so I decreased it to 1 minute. Just change the 30 to a 1. If you want your delay on the order of seconds or hours, just change the m to a "s" or a "h", respectively, no quotes.

[7-10]
PREFIX=/home/gregory/xplanet-images
OUTPUT=xplanet.png
APPEND=2

These I covered in the previous guide, so I don't think I need to go over it again.

[11-16]
GEOMETRY=1024x768
LONGITUDE=-118
LATITUDE=34
#default is no projection,i.e. render a globe
#rectangular is the flat world map. also try ancient, azimuthal, mercator,..
PROJECTION=rectangular

The geometry should be your screen resolution. It is basically how big your image will be. The next two lines should be the longitude and latitude of your location. Currently, it's centered at good ol' Los Angeles, California. As the next two lines explain, the last line is the projection. There are several different options for this. I've only tried the ones on the script, but all of the options are ancient, azimuthal, bonne, gnomonic, hemisphere, lambert, mercator, mollweide, orthographic, peters, polyconic, rectangular, and tsc. Have fun with all of these.

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



I'm not too sure about these. I think they basically say, if the spare file exists, then remove it and put the recommended file on it. If anyone else has an idea what this means, please speak up.

[27-31]
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

These are the lines that actually do something. The first line checks to see if you specified a projection. If you didn't, it calls xplanet without the projection parameter. Now, we're going to study the line after the else statement. The "xplanet" means it's going to run xplanet. The "-num_times" tells xplanet to only run once, and not continue on running. The "-output" tells xplanet to display to a file instead of opening a window; this file is the one you will make as your desktop. The "-geometry" gives the size of the file. Which, in this case, is your resolution which you specified above. The "-longitude" and "-latitude" are pretty self-explanatory; they tell xplanet where to center the image. Lastly is the "-projection" parameter, which tells xplanet what projection to use. These lines are the most important lines in the script.

[33-36]
#update Gnome backgound
gconftool -t str -s /apps/nautilus/preferences/background_filename "$PREFIX$OUTPUT"
sleep $DELAY
exec $0

The line starting with gconftool basically stores the image in memory so that GNOME knows about it (I think). The sleep line tells the script how long to wait. And the exec line tells it to start up again.

7 comments:

tnnd168 said...

Hello! Mozilla Firefox web browser has updated,Please visit my blog,Free download Quickly

cactaur said...

Dude, I use LINUX! My Mozilla Firefox is already updated past 1.5.0.2.

Larry said...

You have no life,you were sick yesterday ,or when this was written ..the 6th of February. Nah I'm just joshin' ya. Anyways I thought I might put an honorable mention on your blog,and here it is

Aww no HTML can be accepted on blogspot comments....pity...

anyways here is the picture ,i could used img src tag

http://img442.imageshack.us/img442/9106/02072007231528pw4.png

Science Thinker said...

that first guy who posted is an idiot

cactaur said...

No, I'm pretty sure he's just a spammer. But, robots are still idiots, so you're right.

Anonymous said...

Sadly, this hack seems to be necessary as nautilus is broken. There is a way to stop nautilus managing (mangling) the desktop window, but then you don't get nautilus' desktop icons.

Also, this script doesn't let you show computer games or videos on your desktop, if you were so inclined.

Rena said...

This is great info to know.