[XConfig - Main]     [XConfig - Xdm]


Xdm - Advanced topics

Ok, now have a look at some advanced topics for SysAdmins...

Modifying the login-screen:

To modify the login-screen you have to edit some Files in <XRoot>/lib/X11/xdm/. Xsetup_0 gets executed at setup of display :0. If you want a blue root window, you have to add e.g. xsetroot -solid CornflowerBlue to <XRoot>/lib/X11/xdm/Xsetup_0. For display :1 you have to add it to Xsetup_1.
Be warned: Every command executed in Xsetup_* is started by root!
Another nice feature is the following Tcl/Tk program (called Powerbox) as a addition to e.g. Xsetup_0:

pidfile=/var/run/xdmbutton_0.pid
if [ -f $pidfile ]; then
  # Huh? Abnormally terminated?
  rm $pidfile
fi

# reboot & halt buttons
HOME=/root /usr/local/bin/wish -name Powerbox <<EOF &
wm geometry . +560+525
tk_setPalette highlightColor blue
button .halt   -text PowerOFF \
  -command {exec /sbin/shutdown -p now 2>/dev/console >/dev/console}
button .reboot -text Reboot   \
  -command {exec /sbin/shutdown -r now 2>/dev/console >/dev/console}
pack .halt .reboot -side left -fill both
EOF
echo $! >$pidfile

These few lines of code open a little window with two button, PowerOFF to turn your computer off, and Reboot to reboot your computer.
You perhaps have to modify some paths and command-line options, specially /usr/local/bin/wish (the Tk interpreter), /sbin/shutdown (the program to shutdown your Computer) and the options to shutdown (obviously you are free to replace the executed command with anything you like).
The wm geometry . +560+525 controls the geometry of this program. +560+525 opens the Powerbox window in the middle of the screen, right under the login box (assuming a screen with a resolution of 1280x1024 pixel).

But wait! If you try the above program, every time you log in you have these two buttons displayed at your desktop. Thats not what we want, we didn't want to reboot the computer right after login, right? Ok, so we have to kill the Powerbox on a successful login, but how to do that...
Let's have a look at <XRoot>/lib/X11/xdm/ again. There's a file called GiveConsole, it gets executed on a successful login. Just add the following to it (don't forget to modify the paths accordingly to your changes you done in Xsetup_0):

# remove reboot/halt buttons
pidfile=/var/run/xdmbutton_0.pid
if [ -f $pidfile ]; then
  kill $(cat $pidfile)
  rm $pidfile
fi

If you experiencing problems with added code to some of the mentioned files you should have a look at the end of xdm-errors, it contains the output of the X server and of every program started in the mentioned files.

Customizing the look further:

There is another interesting file: Xresources. To learn how to use it you should have a look at the explanation what XResources are.


[XConfig - Main]     [XConfig - Xdm]


Questions, critics and bugfixes to: Alexander+XConfig@Leidinger.net