see also: Xresources, GiveConsole, TakeConsole
There is one Xsetup file for each display named Xsetup_# with #=0..n. For example all commands in file Xsetup_0 will be executed for display :0. All these scripts will be started as root.
You may set your default pointer (mouse) cursor, set background image, start xclock, ...
/usr/bin/X11/xsetroot -cursor_name arrow &
xsetroot is part of xorg-x11 and it is used to modify the appearance of the background window. Refer to the man page for additional information.
/usr/bin/hsetroot -full /etc/X11/xdm/pixmaps/nice_background_image.png
hsetroot can be found here: http://thegraveyard.org/hsetroot.php
/usr/bin/X11/xclock -geometry '+0+0' -face "Verdana:pixelsize=11" -digital \ -bg rgb:00/00/00 -bd rgb:00/00/00 -fg rgb:8d/9c/b0 -update 1 -strftime "%a, %d.%m.%Y %R:%S" &
xclock is part of xorg-x11 and has many options. The example above starts a digital clock. See “man xclock” for more information.
If you do not kill xclock after logging in as user it will remain on your desktop. You can do this by adding
/bin/killall xclock
to the file /etc/X11/xdm/GiveConsole.
By using tcl/tk it is possible to create such buttons easily:
pidfile=/var/run/xdmbutton.pid
if [ -f $pidfile ]; then
rm $pidfile
fi
HOME=/root /usr/bin/wish -name power_reboot <<EOF &
wm geometry . -50+20
button .poweroff -text poweroff \
-command {exec /sbin/poweroff 2>/dev/console >/dev/console}
button .reboot -text reboot \
-command {exec /sbin/reboot 2>/dev/console >/dev/console}
pack .poweroff .reboot -side right -fill both
EOF
echo $! >$pidfile
reference: http://www.leidinger.net/X/xdm-advanced.html
more information about the button widget: http://www.tcl.tk/man/tcl8.4/TkCmd/button.htm
If you do not kill this script after logging in as user it will remain on your desktop. You can do this by adding
pidfile=/var/run/xdmbutton.pid if [ -f $pidfile ]; then kill $(cat $pidfile) rm $pidfile fi
to the file /etc/X11/xdm/GiveConsole.
#!/bin/bash
# Set default cursor
/usr/bin/X11/xsetroot -cursor_name arrow &
# Set background
/usr/bin/hsetroot -full /etc/X11/xdm/pixmaps/nice_background_image.png
# Start xclock
/usr/bin/X11/xclock -geometry '+0+0' -face "Verdana:pixelsize=11" -digital \
-bg rgb:00/00/00 -bd rgb:00/00/00 -fg rgb:8d/9c/b0 -update 1 -strftime "%a, %d.%m.%Y %R:%S" &
# poweroff & reboot buttons
pidfile=/var/run/xdmbutton.pid
if [ -f $pidfile ]; then
rm $pidfile
fi
HOME=/root /usr/bin/wish -name power_reboot <<EOF &
wm geometry . -50+20
button .poweroff -text poweroff \
-command {exec /sbin/poweroff 2>/dev/console >/dev/console}
button .reboot -text reboot \
-command {exec /sbin/reboot 2>/dev/console >/dev/console}
pack .poweroff .reboot -side right -fill both
EOF
echo $! >$pidfile
Do not forget to modify your GiveConsole file:
#!/bin/bash # kill xclock /bin/killall xclock # remove poweroff & reboot buttons pidfile=/var/run/xdmbutton.pid if [ -f $pidfile ]; then kill $(cat $pidfile) rm $pidfile fi # give user ownership of console chown $USER /dev/console