XSS Lock Theme

Alan Swanson

Not so much a programmer, as someone who fiddles with things.

This page contains themes and instructions on creating themes for the XScreenSaver lock window patch. Any comments to me.

xscreensaver lock window themes

Replacement for ugly password lock window.
old versions
Updated: 27 Jan 2005

XScreenSaver is a ubiquitous program on Unix for preventing the pixels of your monitor from burning in, providing pretty animations and providing password protection. However, the default lock window used for password protection is bloody ugly.

The author of XScreenSaver has an explanation on why toolkits like GTK and QT are not used for the lock window and I'd agree with his points. However, why not have a built-in theme that is secure?

So what I'm providing here is a framework for creating built-in themes. (Note that themes are not run time changeable - only one can be included at any time.) The default theme is shown in the first screenshot below and other themes are available. Creating a new theme requires some graphical talent (of which I have none) for the frame and logo and some programming experience if you wish to adjust the interior. Please feel free to submit themes and I will include them on this page.

Important: Not compatible with XScreenSaver 5.00 and newer and I am no longer using XScreenSaver so unlikely to be fixed. Sorry.
Notes: Version 1.1 patches XScreenSaver 4.22 and perhaps newer versions. (One small hunk failure against 4.21.)
Notes: Version 1.0 patches XScreenSaver 4.15 to 4.20 and perhaps older versions.


Various themes.
Updated: 22 Feb 2005

Default Theme Metallic grey border with green on black body using Neuropol font.
This is the default theme included in the patch.
Theme Metallic grey border with LCD effect body using Neuropol font.
Theme Based on the Entity theme for the Fluxbox window manager.
By Dean Ashton


How to apply the patch.
Updated: 15 Feb 2005


To apply the patch;

  $ cd xscreensaver-4.XY
  $ patch -p1 < /path/to/xss-lock-theme-1.0.patch

The default theme uses the Neuropol font. This is a free font available on all font sites, use Google to search for it. Download and add it to the X server font directory. If the font is unavailable, the theme will revert back to the default XScreenSaver fonts.


If the XPM's and header file are contained in an archive under a directory named "driver", change to the xscreensaver directory and untar over the existing files;

  $ cd /path/to/xscreensaver-4.XY
  $ tar xzf /path/to/xss-theme-*.tar.gz

Alternatively, just copy the XPM's and the header straight to the driver directory;

  $ cp theme* /path/to/xscreensaver-4.XY/driver/


How to create a local copy of the xscreensaver ebuild with the patch;

  $ mkdir /usr/local/portage

Add PORTDIR_OVERLAY="/usr/local/portage/" to the /etc/make.conf file.

  $ $EDITOR /etc/make.conf
  $ mkdir /usr/local/portage/x11-misc
  $ cp -r /usr/portage/x11-misc/xscreensaver /usr/local/portage/x11-misc
  $ cd /usr/local/portage/x11-misc/xscreensaver
  $ cp /path/to/xss-lock-theme-1.0.patch files/

Add epatch ${FILESDIR}/xss-lock-theme-1.0.patch to the xscreensaver-4.XY.ebuild file in the src_unpack function after the cd ${S} line.

  $ $EDITOR xscreensaver-4.XY.ebuild
  $ ebuild xscreensaver-4.XY.ebuild digest
  $ emerge =xscreensaver-XY

The local ebuild will take precedence over the original ebuild.

creating themes

Notes on creating themes.
Updated: 27 Jun 2005


A theme is made up of nine XPM images and a header file;

theme.h Header file containing settings for fonts, colours, sizes and border control.
theme_logo.xpm The logo contained within the body of the window.
theme_frame_tl.xpm Top left corner of border.
theme_frame_t.xpm Top of border.
theme_frame_tr.xpm Top right corner of border.
theme_frame_l.xpm Left side of border
theme_frame_r.xpm Right side of border
theme_frame_bl.xpm Bottom left corner of border.
theme_frame_b.xpm Bottom of border.
theme_frame_br.xpm Bottom right corner of border.

special XPM requirements

The XPM image files must to be indexed to 90 colours or less. While this saves on file size by using only one character per colour ("A" versus "AB") in the colourmap, the real reason is that XScreenSaver will abort if it is not one character per colour. This will kill your entire session, not just XScreenSaver.

The XPM declaration has to be changed from the default;
  static char * theme_logo [] = {
To a double "const" as below;
  static const char * const theme_logo [] = {

design notes

The corner images are aligned to the inside of the frame.
The top, bottom and side images are aligned to the outside of the frame and are drawn as either a repeating pattern or centred once.

For arranging the borders a picture is worth thousand words. The following is a repeating border sized to fit the window.

Top and bottom image.
20 x 10
Left and right image.
30 x 20
Corner image.
20 x 20

As the top and bottom heights are smaller than the corner heights, they are visually aligned to the outside.
As the left and right image widths are larger than the corner widths, the corners are visually aligned to the inside.

Corner effects can blur into the side sections, so put a section of background colour on the inside of the corner and make the sides the actual (smaller) size of the border. For example and adjust the internal border as appropriate.

header file

Defines Description
General foreground and background colours using standard hexadecimal pixel values such as "#A0123F".
The foreground and background colours for the label fields (LABEL), password fields (PASSWD), date field (DATE), option login button (LOGIN) and status display if password check failed. Uses standard hexadecimal pixel values.
The fonts for the label fields, password fields, date field and status display. Uses the X Logical Font Description Conventions such as;


The status display is shown when the password is entered and overwrites the body of the window. Unlike the pasword maxmimum string length check, this font size is not taken into account when defining window size so if it is too big it will write into the borders.
The countdown thermometer colours. Note the background is the outline box, not the background which will be the general background colour.
THEME_THERMO_WIDTH The width in pixels of the countdown thermometer.
Define these if the repeating side pixmaps need to be drawn complete, i.e. not cut-off on last image.

Generally you would define the top and left only as the top and bottom widths or right and left heights will usually be same size. The exception is if the opposing side is centred (in a mixed setting).
Define these if the side pixmaps are to be centred once and not repeated.
THEME_INTERNAL_BORDER The spacing in pixels between frame and outside edge of logo, test and thermometer. Remember to take account of background colours in frames and that side pixmaps are aligned on outside edge.

For example, if the corner pixmap is 15x15 with inner 3x3 of background colour (allowing for corner effects) and the edge pixmaps are 12x20 and 20x12 then instead of a border of 15 perhaps select 12.
THEME_INTERNAL_SPACER The spacing in pixels between logo to label, label to password and password to thermometer.

the end