Christian Koch


Customizing a graphical login with XDM and other basic tools

Tue March 11, 2014

XDM’s default login screen is pretty ugly, at least for NetBSD. It is pretty configurable, but still, what’s the point if there exist a number of alternatives? LXDM, GDM, SLiM and more all got started as a reaction to XDM’s ugliness.

(click to zoom in)

Actually, that’s a very old NetBSD default login. The white background behind the flag has been replaced with the shade of gray matching the login widget, but still. That X11 black-and-white weave! Ughhh.

Anyway, SLiM is the most no-nonsense of all of the alternatives, as far as I can tell. Doesn’t seem that difficult to configure, too. Unfortunately, I’ve never been able to get it to work on my NetBSD machine. Maybe I need to update my pkgsrc-wip collection, but the fact that SLiM is still inside pkgsrc-wip isn’t a good sign, either.

The solution that just makes the most sense is to use XDM directly — it ships with the base system, for crying out loud. However, I kept running into trouble trying to set the background image. Also, there are a whole bunch of scripts that need to be touched:

$ ls -F /etc/X11/xdm
GiveConsole*
TakeConsole*
Xaccess
Xreset*
Xresources
Xservers@
Xservers.fs
Xservers.ws
Xsession*
Xsetup_0*
Xstartup*
Xwilling*
xdm-config

What you have to do is RTFM, but it’s really huge. Here’s the condensed version:

  1. The Xsetup_0 shell script is executed, (this is where you customize the login screen),

  2. then login widget is presented, whose appearance is controlled by the Xresources file, and upon successful authentication,

  3. then the Xstartup script is executed. This script usually registers users sessions and updates utmpx(5) and stuff like that. However, you can arbitrarily deny login to somebody and do things like that. This whole login cycle is restarted if this script exits unsuccessfully.

  4. Last, the user’s ~/.xsession script is executed, or /etc/X11/xdm/Xsession if it doesn’t exist. The session is terminated when this script is completed.

Anyway, the task of customizing the login screen is not that complicated once you realize the only scripts that actually do that are Xsetup_0 and Xresources. Here is a simplified version of mine, with all of the conditional statements stripped out:

!! cfk's Xresources for the XDM login widget

Xcursor.theme: whiteglass

xlogin*greeting:
xlogin*greetFace: Serif-18:bold:italic
xlogin*sepWidth: 0
xlogin*greetColor: black 

xlogin*namePrompt: Login:
xlogin*fail: Login incorrect
xlogin*failTimeout: 3

xlogin*echoPasswd: true
xlogin*allowNullPasswd: false
xlogin*allowRootLogin: false

xlogin*width: 560
xlogin*height: 225
xlogin*x: 25
xlogin*y: 545

xlogin*face: monospace-14
xlogin*promptFace: monospace-14:bold
xlogin*failFace: monospace-14:bold
xlogin*failColor: #990066

xlogin*borderWidth: 1
xlogin*frameWidth: 0
xlogin*innerFramesWidth: 1
xlogin*hiColor: grey15
xlogin*shdColor: grey15
xlogin*background: grey
xlogin*foreground: black
*Foreground: black
*Background: #fffff0

xlogin*logoFileName: /usr/X11R7/include/X11/pixmaps/NetBSD-flag1.xpm
xlogin*logoPadding: 5
xlogin*useShape: false

 

#!/bin/sh
# CFK's Xsetup_0

# It *is* necessary to set some HOME directory, otherwise feh fails.
# Be sure to read /var/log/xdm.log from time to time!
export DISPLAY=:0.0 
export HOME=/root
/usr/pkg/bin/feh \
  -q \
  --bg-scale \
  /home/christian/pictures/wallpapers/other/anime.netbsd.mai.colour.png

This is the result on my Sony Vaio:

(click to zoom in)

Getting everything to look like that was a very iterative process with a lot of trial and error. By the way, I found the root image here. I am in no way, shape or form into anime (I appreciate it, I just can’t hold a conversation about it) but at least it makes NetBSD look kinda sexy.

feh is a pretty basic wallpaper-setter, but of course the best thing would be to find something even more basic. As far as I can tell, you can’t set arbitrary images there with the tools from the default X11 distribution. The best I’ve been able to manage is a simple grid pattern with xsetroot(1).

comments powered by Disqus