I have been working on making my own screensaver. Ubuntu uses gnome-screensaver, but there seems to be absolutely no information online about how to write a screensaver compatible with gnome-screensaver. Last year, I made a bunch of progress, figured it out, and I was going to post a tutorial. There still aren't any tutorials out there, so I thought I'd post how I made a screensaver. It's not a full tutorial, but it's better than nothing. Below you should find instructions to download, compile, and install a simple, commented screensaver that uses OpenGL to show a rectangle that changes color.
For a program to be run by gnome-screensaver, it must use a gs-theme-window. To use this window, you will need the files:gs-theme-window.c gs-theme-window.h (also in attached tar)
You'll also need the gtk libraries installed, libgtk2.0-dev libgtkglext1-dev. The second one is an OpenGL extension for Gtk.
Download the sample files, and extract them, and try to compile.
sudo apt-get install libgtk2.0-dev libgtkglext1-dev
It should compile with one warning, though I have not throughly tested. Let me know if it doesn't work for you, and I'll try to help.
tar -zxf sample_screensave.tar.gz
Try running it, just to be sure it works
The code is fairly straightforward and well commented, so you should easily be able to hack it to do what you want. Now to get gnome-screensaver to use it.
You must put the screensaver into the location gnome-screensaver can run it from. Find the directory with:
Copy the program into that directory. Then edit the your_screensaver.desktop file and ensure that it is referring to the location you just put the screensaver in. Then copy the desktop file into the location given by
pkg-config --variable=privlibexecdir gnome-screensaver
Theoretically, you should now be able to choose your screensaver:
pkg-config --variable=themesdir gnome-screensaver
However, it doesn't show up for me. That's where you are supposed to put the file from what I can tell, but it doesn't show up as an option until I put the .desktop file in:
I have no idea why, but if you put the desktop file there, you should be able to use your new screensaver. Happy Hacking, and I'll try to answer any question you post. Also, if anyone *does* know of a tutorial, please say so!