Xplanet – improve your background
Xplanet is program which displays a picture of the Earth.
It was inspired by Xearth.
Xplanet can draw all the major planets and most satellites. I use it to provide the background
image on my machines which run X. You can also download satellite
images of cloud cover so your background reflect reality. I also display the daylight/darkness
shadow. It makes for a very interesting and dynamic background. Have a look at their
gallery of images. Very nice eye candy!
The image below is is an example of what I have on my laptop. If you click on it, you’ll see the full
1024×768 image. Also present, but from a different time of day, is what the screen shot looks like without clouds.
I am assuming you already have X up and runnning. I am also using
KDE in this example. I’m sure the
instructions for other window managers will be simliar.
But wait! Where’s the BSDCan update?
It’s been just over 5 days since the Sunday BSDCan breakfast. I spent Monday doing nothing much. Tuesday involved a few emails. Wednesday I did a lot of changes to the BSDCan website to get a /2004/ archive going. That should be ready soon. This morning (Thursday) I updated the ad serving software. In the process, I found this half-completed article and thought I should update and commit it before it got lost. It’s also a nice break from the accounting and receipt wrap-up of BSDCan.
Installing Xplanet
Use the ports, of course.
cd /usr/ports/astro/xplanets make installYou could also try
pkg_add -r xplanet
, but for this, I prefer adding from ports.
Configuring Xplanet
Here is how I configured Xplanet on my IBM ThinkPad T22 running FreeBSD 5.2.1:- Start KDE (I’m running KDE 3.2.2).
- Right click on the background.
- Select
Configure Desktop
. - Click on
Background
in the left hand panel. - In the Background group box, I have
No picture
selected. - Click on
Advanced Options
. - I have
Use the following program for drawing the background
checked. - Select XPlanet in the list (I also have
kdeworld
andkwebdesktop
listed). - Click on Modify.
- My
Command
entry is:xplanet --num_times 1 --geometry %xx%y --output %f.jpg --projection \ merc --latitude -5 && mv %f.jpg %f
You’ll probably want to combine those two lines into one. - My
Preview cmd
entry is:xplanet --num_times 1 --geometry %xx%y --output %f.jpg --projection \ merc --latitude -5 && mv %f.jpg %f
Again, you’ll probably want to combine those two lines into one. - I have my
Refresh time
set to 5 minutes.
But wait! There’s more!
You don’t have clouds yet. The Xplanet Maps & Scripts pages shows you how to do this. There are two parts:- obtain a cloud map
- tell Xplanet to use it
Get the map
I second the advice given on the Xplanet Real Time Cloud Map page. Install the script provided by Oliver White. His scripts downloads the file from a random mirror. Help to distribute the load. Note: I had to installwww/p5-ParallelUA
to get the script to run.
Tell Xplanet about the map
Xplanet has a rather extensive man page. It also has configuration files at/usr/X11R6/share/xplanet/config
. The file I changed is
/usr/X11R6/share/xplanet/config/default
and I added this entry:
cloud_map=/home/dan/clouds/clouds_2048.jpgThe file referenced by the
cloud_map
entry
is also specified within the script I referred to above.
In later versions of xplanet
, that entry should be placed within the Earth section,
as shown below:
[earth] "Earth" color={28, 82, 110} cloud_map=/home/dan/clouds/clouds_2048.jpgThe settings not related to
cloud_map
are the values I found in the file:
creating a cronjob
I created a shell script to invoke the above mentioned perl script. This shell script ensure that we always have a valid cloud map.
#!/bin/sh cd ~/clouds perl ~/clouds/download_clouds.pl if [ -s clouds.jpg ] then RESULT=`file clouds.jpg | grep -c "JPEG image data"` if [ $RESULT -eq 1 ] then mv clouds.jpg clouds_2048.jpg else rm clouds.jpg fi else rm clouds.jpg fiIt invokes the perl script, then makes sure that the resulting file is non-zero in size. The script then verifies that the file is a JPEG image, as opposed to an HTML file as might be returned in a 404 error. If all is OK, it moves the fetched over over the stored file and finishes. The cronjob I use to invoke the shell script is:
15 */3 * * * dan /home/dan/bin/clouds.shThis will run at 15 past the hour, every three hours. However, why run it that often? For example, if you’re doing this on your office system, why not restrict updates to something that resembles your working hours? Something more like this:
15 7-18/3 * * 1-5 /home/dlangille/bin/clouds.sh > /dev/nullDetails:
- 15 – run at 15 minutes after the hour
- 7-18 will run it only between 7AM and 6PM. And then only every 3 hours. ie. 7AM, 10AM, 1PM, etc.
- 1-5 will run the job only on Monday-Friday
2>&1; > /dev/nullThat should be everything you need to have a much more interesting background. Enjoy.
Hello,
the Perl script for downloading clouds didn’t work for me (some module missing),
being a Python user / fan, I’ve created a Python version of the script, with optional archivisation of the cloud image. Works with your default Python installation.
I’ve sent the script to the xplanet webpage admin, but until it gets there, you can fetch it from here:
<http://dotz.w.lub.pl/download_clouds.py>
Have fun!
—
m
[%sig%]