Testing and installing a new module

We consider as an example the module simplesquares.c. The steps needed to make it run are:
  1. Compile the module. If it only uses Xlib functions (like the modules in this tutorial), this is:
    gcc -o simplesquares simplesquares.c -L/usr/lib -lX11
    On older distributions, it could be:
    gcc -o simplesquares simplesquares.c -L/usr/X11R6/lib -lX11
    In general, the directory to use in -Ldirectory is the one containing libX11.so, and can be found by:
    find /usr -name libX11.so
  2. The module can be tested by simply running it. The output goes in the root window, which is often visible as the "the background of the screen". Some window managers hide the root window with another window: in this case, the module can be tested by installing it as a screensaver module (see below)
  3. Make sure that the executable is your path.
  4. Add the module to the xscreensaver configuration file. This is done by creating a file .xscreensaver in your home directory. For a single module, this contains a line like:
    programs: simplesquares
  5. To test the module, use xscreensaver-demo (use the "preview" button)