The X Display Manager (XDM) Part 3 Configuration

Published on April 2, 2023 at 4:21 pm by LEW

Introduction

At this point, if you are coming from the previous post, you should have everything installed to configure XDM as your Display manager (we already turned it on). If not, then you might want to go back and read the previous offerings in this series of posts.

Now we want to take a look at the XDM configuration files, their structure, and how to add a few helper applications. As a reminder, the below image is what we are working towards.

XDM Customized Login Screen

XDM is a fairly complete login manager, that can also handle remote log in. But it does not provide any additional services itself. What you see on the login screen (local or remote) is what you get. We will not only be configuring XDM, but also adding some small application to provide additional functionality from the login screen.

Note that I am assuming you are not planning on using remote log in for any reason, so I will not be covering this feature.

I am also assuming you have changed into the /etc/X11/xdm directory, and will not be using full file paths. So if you have not, you may need to add the above path to the commands used.

XDM-Config

On Arch Linux, the XDM configuration files are located in /etc/X11/xdm. The first one we will look at is the xdm-config file. The main thing this file does for us is tell XDM where all its other files are located. We will not make any changes here.

Xsetup_0

The first file we will actually modify is Xsetup_0 (may be called just Xsetup in some distributions). The first thing we want to do is make a copy of the original file. Remember always make a copy of the original file. They are text files and they are small!

# cp Xsetup_0 Xsetup_0.bak

Once you enter the file with your favorite text editor, you will see it is a script file. This means we can add lots of comments about what and why (staring a line with a # makes it a comment).

The only thing that should be in this file on a fresh install is a xconsole command. I have no plans to use the console on this install, so I delete this line.

Here is what I enter instead, minus my comments.

feh –bg-scale /path/to/image

xclock &

(
    xmessage -buttons Shutdown:20,Reboot:21 β€œβ€;
    case $? in
        20)
            exec /sbin/poweroff;;
        21)
            exec /sbin/reboot;;
        *)
            echo β€œxmessage exit `date`”;;
    esac
)&

I do want a nice background image, so I will enter a line to run the feh program we installed to set up a scaled background image on the root screen. I store my wallpaper in /usr/share/wallpaper, but feel free to set your own wallpaper location.

I want to placed a clock on the login screen. I will use the xclock program we installed. Since we want this program to run in the background and not halt file execution, we append a & to the end of the line. We will configure xclock with X resources later.

I also want a couple of buttons for reboot and shutdown. For that I will use xmessage, which we also installed earlier. The parentheses run the commands in a sub shell. I use the case statement to parse the value returned when one of the buttons is pressed.

One thing to remember, at this point everything is running as root.

GiveConsole

I want to tackle GiveConsole before Xresources, as Xresources is the big one.

GiveConsole is called before XDM exits on successful log in. So before giving control over to the user we need to close the helper programs we launched with Xsetup_0.

So just before we change over to the user (line that starts with chown command), while we are still root, we need to add kill statements. Here is the specifics for this example to enter in the GiveConsole file.

killall xclock
killall xmessage

Xresources

This is the big one we need to make changes too. So make sure to have a backup copy. Also remember that I am working Arch. A different distribution may have some differences. So do not take what follows word for word.

The fist thing I do is remove Xresourcres for Choser and Xconsole from the bottom of the fie, as I am not using them, so no need for styling them.

The Xresoures file is designed to be somewhat general. There are some if-then statements for varying displays. I delete the if – then framework, and the options that do not apply. You will also have to decide what font system you will use. The default file has both old (font) and new (face) entries. For example xlogin*promptFont is old system, and xlogin*promptFace is new system. You only need one.

You want to leave the top part of the file (Xcursor and translations) alone. With what is left we can style xlogin (authentication widget). The below is my xresources for the authentication/login widget.

xlogin*geometry: 500x250-20+80
xlogin*frameWidth: 0
xlogin*shdColor: #eeeeee
xlogin*hiColor: #eeeeee
xlogin*background: #222222
xlogin*innerFramesWidth: 1

xlogin*borderWidth: 1
xlogin*borderColor: #222222

xlogin*greeting: Welcome to Archer
xlogin*greetFace: Serif-18:bold:italic
xlogin*greetColor: #6699dd

xlogin*namePrompt: New User:
xlogin*face: Helvetica-12
xlogin*promptFace: Helvetica-12:bold
xlogin*promptColor: #eeeeee
xlogin*inpColor: #eeeeee
xlogin*foreground: #222222
xlogin*echoPasswd: true

xlogin*fail: Login incorrect or forbidden by policy!
xlogin*failFace: Helvetica-18:bold
xlogin*failColor: #dd9966

I have grouped the xresoruces by what they do for the authentication widget. For brevity I will only run through one example, leaving geometry aside for the moment, but you should get the general idea. You should compare the above to the XDM image. Lets look at the lines related to the Greeter (the message at the top of the authentication login widget).

The first thing to note is they all have the same beginning, β€œxlogin*greet”. This tells us they are related. The greeting is the actual text that will be displayed. The Face sets the scalable font being used (we will talk about the older font system when we talk about xmessage). And Color is the color of the text, in this case we are using hex RGB values.

The XDM man page has a very good write-up about what most of the Xresources for the authentication widget (login) do.

Now lets talk about geometry, or size and placement of the authentication widget. You can do this in four entries (as shown in the man page) or just one. While not stated in the manual, xdm recognizes the geometry option, which is what I used to set the geometry in just one line.

The first two numbers are the size of the widget (X by Y). The second set of numbers indicates the offset of X and Y from the borders. Upper left is + + and lower right is – -. So in this case the widget is 500x 250 in size (or twice as wide as it is high). It is positioned 20 in from the right border (-) and 80 down (+) from the top border.

We now have two more widgets to set, xmessage and xclock. This works pretty much the same, except we will be using old style fonts. The old style fonts under X have fourteen sections. The easiest way I found to do this is to run mkfontdir. This program will go through your various font directories and create files with the old style names. These files will be called either fonts.dir or fonts.scale. An example entry;

DejaVuSans-Oblique.ttf is equivalent too
-misc-dejavu sans-medium-o-normal--0-0-0-0-p-0-adobe-standard

If you are having problems, you might want to install the package xorg-xfontsel. The xfontsel program will let you modify each of the fourteen values and see what the resulting font will look like. You will most likely have to play with the formatting to get things the way you want.

Lets take a closer look at the xmessage formatting. This is placed directly beneath the greeter and has the same background color. Also note I force the non use of scroll bars.

Xmessage*geometry:	    175x35-20+330
Xmessage*background:   #222222
Xmessage*foreground:   #eeeeee
Xmessage*Font:	    -misc-*-*-*-*-*-20-*-*-*-*-*-*-*
Xmessage*borderWidth:  0
Xmessage*borderColor:  #222222

Xmessage*Text*background:  #222222
Xmessage*Text.borderWidth: 0

Xmessage*message.scrollVertical:   Never
Xmessage*message.scrollHorizontal: Never

Next are the xresources for the xclock. The geometry places it to the left of xmessage and just below the authentication widget, with the same background color. Analog is set to false, forcing digital. The strftime is a standard library for dealing with date and time (%A gives us the day name, %F gives us YYYY-MM-DD, and %T is HH:MM).

XClock*geometry: 332x35-190+330
XClock*analog:false
XClock*strftime:(%A)\040%F\040%T
XClock*update:1
XClock*render:false
XClock*font: -misc-*-*-*-*-*-20-*-*-*-*-*-*-*
XClock*foreground: #eeeeee
XClock*background: #222222
XClock*borderWidth: 0
XClock*borderColor: #222222

Conclusion

After performing a reboot you should come up in your new stylized XDM login screen. Take a look and make some notes about placement of elements (in case something is not quite in the right place, or you want to try different layout).

Once setup it is easy to play with the geometry and coloring to get the login display you want!

The X Display Manager (XDM) Part 1 Preparation

The X Display Manager (XDM) Part 2 Basic GUI

The X Display Manager (XDM) Part 3 Configuration

Add New Comment

Your email address will not be published. Required fields are marked *