The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.

Things look quiet here. But I've been doing a lot of blogging at because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Xplanet - improve your background 21 May 2004
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles

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 1024x768 image. Also present, but from a different time of day, is what the screen shot looks like without clouds.

xplanet xplanet

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 install
You 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:

  1. Start KDE (I'm running KDE 3.2.2).
  2. Right click on the background.
  3. Select Configure Desktop.
  4. Click on Background in the left hand panel.
  5. In the Background group box, I have No picture selected.
  6. Click on Advanced Options.
  7. I have Use the following program for drawing the background checked.
  8. Select XPlanet in the list (I also have kdeworld and kwebdesktop listed).
  9. Click on Modify.
  10. 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.

  11. 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.

  12. I have my Refresh time set to 5 minutes.

With that, you should have an Xplanet background.

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:

  1. obtain a cloud map
  2. tell Xplanet to use it

Cloud images are updated every three hours. There is no sense in getting the maps any more often than that. Please do not abuse this service. Do not run your cronjob any more often than that. Many cloud map servers have been shut down because of people fetching more often than necessary.

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 install www/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:


The 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:

color={28, 82, 110}


The 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.

cd ~/clouds
perl ~/clouds/
if [ -s clouds.jpg ]
	RESULT=`file clouds.jpg | grep -c "JPEG image data"`
	if [ $RESULT -eq 1 ]
		mv clouds.jpg clouds_2048.jpg
		rm clouds.jpg
	rm clouds.jpg

It 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/

This 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/  > /dev/null


  • 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

Why restrict? To reduce the bandwidth consumed. This helps out both yourself (or your office) and the provider of the images. Every bit helps.

Once it has run sucessfully, you can get rid of the output that is mailed to you by adding the following to the end of the line:

2>&1; > /dev/null

That should be everything you need to have a much more interesting background. Enjoy.

Need more help on this topic? Click here
This article has 1 comment
Show me similar articles