Creating GDM Themes HOWTO

This guide provides basic information about the creation of GDM Themes.

Components of a GDM Theme

A GDM Theme is basically composed by:

  • A background image
  • A screenshot to be displayed in the GDM Configuration
  • Icons (images for the icon bar)
  • An xml file, where the actual theme is defined. This file allows the declaration of frames, images, the login box, caps lock warning frame, background, icons, multi-language captions, etc.
  • The GdmGreeterTheme.desktop file, which is not a true .desktop file, but it contains the name of the xml, screenshot and other information to be displayed in the GDM Configuration screen

Creating your own theme

It is always easier to start off of an existing theme, rather than doing it from scratch. In general, the first item to be changed is the background image. The background image must be at least as big as the screen resolution. In order to make the theme suitable to other users, it is a good idea to use at least 1600x1200 pixel images, as they look sharp even on high-resolution screens. A small image can also be used, but it will loose quality when expanded. The image must be placed in the theme directory and declared in the xml file as follows:

<item type="pixmap">
<normal file="background.jpg"/>
<pos x="0" y="0" width="100%" height="0"/>
</item>

Next, you will have to reposition your prompts menus, labels and icons in order to match your background image. Even though you can make it all transparent, a centered login box might not always the best choice.
You can define images, rectangles and labels with the following tags (respectively):

<item type="pixmap">
<item type="rect">
<item type="label">

Using the item tag, you can also specify the location of option buttons, system messages, login screen, etc, by adding id= to the item tag. All the GDM system tags I am aware of are:

<item type="rect" id="language_button" button="true">
<item type="rect" id="session_button" button="true">
<item type="rect" id="system_button" button="true">
<item type="rect" id="disconnect_button" button="true">
<item type="label" id="clock">
<item type="rect" id="caps-lock-warning">
<item type="rect" id="timed-rect">
<item type="label" id="timed-label">
<item type="label" id="pam-prompt">
<item type="entry" id="user-pw-entry">
<item type="label" id="pam-message">
<item type="label" id="pam-error">

Use the pos tag within each item section to define its x,y position and make sure it all looks in harmony with your background image. Last, the xml file must be declared in the GdmGreeterTheme.desktop file as follows:

Greeter=theme.xml

Capturing your GDM screen

Once you masterpiece is done, you will need a screenshot. This part is a bit tricky as you have already logged off and do not have access to The Gimp or any other graphical screen capture application.
The best way around is to create a small script that switches from the text console to the graphical screen and takes the picture automatically. This script can be created by issuing the following command in your console:
echo "chvt 7 ; sleep 5 ; XAUTHORITY=/var/gdm/:0.Xauth DISPLAY=:0.0 import -window root /tmp/gdm-shot.png" > /tmp/capture[[TableOfContents]]
Note: This assumes your login screen is in VT7, meaning that you press CTRL+ALT+F7 to switch to your graphical screen
Now log off to the GDM screen and hit CTRL+ALT+F1 to switch to your text console. Log in as root and type sh /tmp/capture. The screen will switch to GDM and after five seconds you will hear a BEEP. If everything worked as expected, your screenshot will be located at /tmp/gdm-shot.png
Note that import is part of the ImageMagick package .
If you have xnest installed, you can also use gdmthemetester.

Now put the screenshot in your theme directory and make a reference to it in your GdmGreeterTheme.desktop, adding also your author, name, description and copyright fields as follows:

Update to capture GDM screen

An easier way to capture your GDM screen would be like this:

Open a terminal and enter these commands (assuming you do not have xnest installed):

sudo apt-get install xnest
gdmflexiserver --xnest

This will open a new window and show your GDM login screen (you have to tarball (using the directions below) and install the theme in your Login Screen Manager first (Menu>System>Administration>Login Window>Local(tab)>+Add and select your newly tarballed theme, then check the radio button next to it in the list and "close").

Now just hit the "PrtScr" button and save the screenshot. Open the newly created screenshot in GIMP or your favorite image editor and shrink the screenshot down to 188x140.

Note: This was only tested using Ubuntu 7.10 Gutsy Gibbon, so I am not sure it works on other Linux flavors.

[GdmGreeterTheme]
Greeter=theme.xml
Name=Coliseo
Description=Il Coliseo, night shot by http://julian.coccia.com
Author=Julian Coccia
Screenshot=Coliseo.jpg
Copyright=Copyright (C) 2003, Julian Coccia

Finishing up

Last, all you have to do is a gzipped tarball with tar -zcf MyTheme.tar.gz MyThemeDir and presto!. It can be now easily installed on any computer from the GDM Configuration Screen.

Previous chapter: Gtk+ Themes

Back to Tutorial start page

Next chapter: Metacity Themes

Attic/GnomeArt/Tutorials/GdmThemes (last edited 2013-11-27 14:33:52 by WilliamJonMcCann)