Customizing the XDM Login Screen

How would you like your screen to look on start up? Here's how to make it look your way.
Changing the Background Pattern

A bitmap can be used to tile (copied over and over to cover the whole display) a simple two-color image onto the background instead of a solid color. There should be a collection of bitmaps in /usr/include/X11/bitmaps. You can also create your own using the bitmap program included with X windows. Try changing the xsetroot line to this:

/usr/X11R6/bin/xsetroot -bitmap\
/usr/include/X11/bitmaps/xsnow

Restart XDM as before, and you should now have a nice winter scene. You can change the foreground and background color with the bitmap by adding the -fg and -bg options and specifying a color. Try changing it to this:

/usr/X11R6/bin/xsetroot -bitmap\
/usr/include/X11/bitmaps/xsnow -fg blue -bg yellow
Not the most wonderful colors for snow, but you get the idea. The colors recognized by the -fg and -bg options are the same as the ones in the rgb.txt file discussed above.

You can also tile color bitmaps stored in the xpm format. The xpmroot program is used for this. Change the xsetroot line to something like this:

/usr/X11R6/bin/xpmroot\
/usr/include/X11/pixmaps/file.xpm
Displaying a Background Image

Now that we can display colors and tiled bitmaps on the background, it is time to display a picture on the background. To do this, I use a shareware graphics program called xv. You can get it from the xv home page at http://www.trilon.com/xv/, or it may be included with your Linux distribution. Remember, this is shareware, and you should support the author by sending him $25 if you find his program useful.

I have chosen to use xv, but any program capable of displaying an image on the background can be used. For xv, you tell it to display the image centered on the background. You also want it to exit immediately after displaying the image; otherwise, XDM will hang until the xv program is exited manually.

/usr/X11R6/bin/xv -root -rmode 5 -quit\
/root/.gromit01.jpg

I use this to put a picture in the center of the display. To view your changes, save the Xsetup file and press <H>ctrl<H>_<H>alt<H>-F7 to switch back to the XDM screen. Press <H>ctrl<H>-<H>alt<H>-<H>backspace<H> to restart the X server. You should now see your image in the center of the screen, covered by the login box. xv supports several other placement options using the -rmode command. You can see a list of these options by typing xv -rmode -1.

Displaying Random Images

Listing 1

With the help of a simple Perl script, you can display a random image on the background each time XDM is run. Listing 1 is a simplified version of a script written by Scott Scriven, toykeeper@cheerful.com.

Type in this program or download it from ftp.linuxjournal.com/pub/lj/listings/issue68/3325.tgz. and save it as /usr/local/bin/bkgd. Make sure execute permissions are set by typing:

chmod ugo+x /usr/local/bin/bkgd

You may also have to change the path to xv and find to match your local setup. Including the absolute paths in the script ensures it will work correctly, even when the $PATH environment variable isn't set.

To load a random background, change the xv line in Xsetup to usr/local/bin/bkgd instead. Create a /usr/lib/X11/backgrounds directory and fill it with your favorite images. A couple of good places to look for background images are http://www.digitalblasphemy.com/ and http://ipix.yahoo.com/.

Listing 2 is a working Xsetup file with the intermediate steps commented out with “#” characters.

Listing 2

Customizing the Login Box

Now we want to customize the xlogin box using the /usr/lib/X11/xdm/Xresources file. This file is also used for configuring other XDM widgets like the chooser, but we aren't going to deal with these other options here—see the XDM man page to learn about them.

We can move the xlogin box, resize it, change its color, its fonts and what it says. I have moved mine into the lower-right corner and made it as small as I can, so that it doesn't cover up the background image.

The XDM xlogin widget uses X resources to specify these settings. They are all stored in the Xresources file and are read by XDM each time it restarts. A list of the available options, taken from the XDM man page, is shown in “Xresources Options”. I will go through each option and explain its use.

I have ignored several more advanced xlogin resources, some of which may appear in the Xresources file. It is safe to leave them alone—the defaults set when you installed X should work fine. The XDM man page contains full descriptions of each option, if you want to experiment with them.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

XDM Greeter

Anonymous's picture

In Suse 10.3 (gnome), xdm displayed the login prompt in a tasteful and dignified rectangle. In Suse 11.1, it uses a picklist of users with a gnomeish graphic. How can I cause it to use the previous style?

Thanks

SuSE 11.1 does not use xdm

Anonymous's picture

SuSE 11.1 does not use xdm by default, but gdm.
You can change this by editing the file
/etc/sysconfig/displaymanager - just replace the
line DISPLAYMANAGER="gdm" by DISPLAYMANAGER="xdm".

Of course, the "right" way to do this is via YaST's
editor for /etc/sysconfig (found under "System").

HTH.

XDM

Anonymous's picture

Cool, I couldn't find a sample/tutorial on XDM theming!
thanks for telling everyone which files do stuff with XDM, and the backgroun patten/image stuff was realy usefull!

do you know if/how you can define Alpha chanel (transparency) in objects - like the xlogin box for example?
do you know if XDM has a face/user browser that can be used for clicking on a user instead of typing a username, or will i have to hack XDM and past this feature from GDM for example?

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix