As a astronomy enthusiast, I really like the default screensaver that comes with gnome-screensaver, named “cosmos”. It’s nice but not ideal:

  • It has only few images
  • Images do not have any captions – it would be very nice to have even some description of what are you looking at

I’ve decided to create a similar screensaver but with other set of images. When the screensaver is ready, we will package it for Debian/Ubuntu as a .deb so other people can install it easily. A screensaver that I have created (and used as an example here) consists of wallpapers downloaded from http://hubblesite.org/gallery/wallpaper/ .

OK, let’s get cracking! I have prepared a template for the deb package – start with downloading it: screensaver-template.tar.gz and extracting it somewhere in your home directory (tar -zxf screensaver-template.tar.gz).

Now it’s time to add some photos – create a directory inside screensaver-template with the name of your choice. I have put my images in screensaver-template/hubble but you should choose a different name. Copy all the images inside your directory, I’m assuming those will be *jpg files.

gnome-screensaver requires XML file that describes your images – you will find a script inside my package that create the xml file for you: copy create-xml.sh inside your directory with pictures and run it. It will generate background-1.xml file. Have a look inside – it’s pretty straight forward. It assumes that all your images will go into /usr/share/backgrounds/<YOUR_DIR>/. Remove create-xml.sh from your directory – we won’t need it there.

gnome-screensaver also uses .desktop files to manage available screensavers. This file allows you to see your screensaver (it’s acually called screensaver theme) in “Screensaver Preferences”. There is ready to edit file in the template called “hubble-slideshow.desktop”. First rename it to “<YOUR_DIR>-slideshow.desktop” – replace <YOUR_DIR> with the same name as your directory for consistency. Edit the file, you will need to change 3 lines:

  • Name – put a short name of your screensaver theme. This will be visible in “Screensaver Preferences”.
  • Comment – description
  • Exec – here change the path after –location-. It will need to match the path used in the XML file, so it will be –location=/usr/share/backgrounds/<YOUR_DIR>

Now it’s time to create Debian/Ubuntu package, go into debian directory and edit following file:

  • README – put general information about your screensaver there
  • changelog – edit changelog information: change package name, add anny comment if you with and change the signature. Keep the format of this file as in the template!
  • control – change “Source:” and “Package:” lines with the name of your package. Also edit “Maintainer:”, “Homepage:” and “Description:”
  • copyright – put all copyright information there
  • install – here we are telling package manager that it needs to install two things:
    • <YOUR_DIR> into usr/share/backgrounds – rename “hubble” on this line to your directory name
    • .desktop file should go into usr/share/applications/screensavers – rename hubble-slideshow.desktop to <YOUR_DIR>-slideshow.desktop

Go up from “debian” directory and run command:

% dpkg-buildpackage

That’s it!! You will find you package in the directory above named gnome-screensaver-<YOUR_DIR>_0.1_all.deb – install it just like any other package and enjoy your new theme!
Here is the screensaver theme I have created: gnome-screensaver-hubble_0.1_all.deb. It’s nearly 50MB package with 81 images from Hubbe site – enjoy!