An interactive stargazing desktop background

By Colin
Oct 22, 2016
The end result (video).

As described on the project's homepage, Stellarium "is a free open source planetarium for your computer. It shows a realistic sky in 3D, just like what you see with the naked eye, binoculars or a telescope."

It's a really cool application, and we're going to use some tools to make it an always-present component of a desktop computer environment. The end result will be a "desktop background" that displays a model of the sky in your location, updates in real-time, and allows interactive navigation of the night sky with the arrow keys or mouse.

Disclaimer: This is all assuming a Linux environment running X11. It does not work on Wayland (though tips for Wayland support would be appreciated), and although Stellarium is cross-platform, the other tools used are Linux-only. Furthermore, it assumes only 1 display (or possibly multiple displays of the same resolution).

The process is pretty straightforward:

This effectively repurposes an application window as a background, and we can use a tool called Devil's Pie to automate steps 2-6 whenever Stellarium is started. After installing Devil's Pie, create ~/.devilspie/stellarium.ds and populate it with the following:

	(matches (window_name) "Stellarium")
		(geometry "1920x1056")

Be sure to update the "geometry" settings to match your display resolution, minus whatever horizontal or vertical space is occupied by your system menu bars. Devil's Pie will load this file at startup, and the first two lines instruct it to only apply the rest of the script to Stellarium windows. Each line inside the "(begin ... )" block then executes steps 2-6, in order.

Next, we modify Stellarium config files in order to avoid excessive CPU/GPU use while we aren't actively interacting with it. First, install Stellarium, and then locate the following lines inside ~/.stellarium/config.ini:

fullscreen                             = false
horizontal_offset                      = 0
maximum_fps                            = 60
minimum_fps                            = 20

Change the value of "minimum_fps" from "20" (default) to "1". This will make it so that when you aren't adjusting the view with your keyboard/mouse, Stellarium redraws everything at 1 fps. The downside is that initial input will lag by up to 1 second, and if you click on an object to monitor its trajectory, the crosshairs animation will appear jerky. Note: Stellarium doesn't appear to support fractional fps values - 1 fps is the lowest accepted. Also, config changes are correctly preserved across version upgrades.

Finally, instruct your desktop environment to start Stellarium and Devil's Pie at login, and you're set!