xinit(1) is the program that actually starts X; it is called by startx(1), so you may not have noticed it (and probably don't really need to). Its configuration file, however, determines which programs (including and especially the window manager) are run when X starts up. xinit first checks your home directory for a .xinitrc file. If the file is found, it gets run; otherwise, /var/X11R6/lib/xinit/xinitrc (the systemwide default) is used. Here's a simple xinitrc file:
#!/bin/sh # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/usr/X11R6/lib/X11/xinit/.Xresources sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then xmodmap $sysmodmap fi if [ -f $userresources ]; then xrdb -merge $userresources fi if [ -f $usermodmap ]; then xmodmap $usermodmap fi # start some nice programs twm & xclock -geometry 50x50-1+1 & xterm -geometry 80x50+494+51 & xterm -geometry 80x20+494-0 & exec xterm -geometry 80x66+0+0 -name login |
All of those “if” blocks are there to merge in various configuration settings from other files. We'll get to .Xresources in just a moment, but .Xmodmap we're going to leave alone. The interesting part of the file is toward the end, where various programs are run. This X session will begin with the twm(1) window manager, a clock, and three terminals. Note the exec before the last xterm. What that does is replace the currently running shell (the one that's executing this xinitrc script) with that xterm(1) command. When the user quits that xterm, the X session will end.
To customize your X startup, copy the default /var/X11R6/lib/xinit/xinitrc to ~/.xinitrc and edit it, replacing those program lines with whatever you like. The end of mine is simply:
# Start the window manager: exec startkde |
Note that there are several xinitrc.* files in /var/X11R6/lib/xinit that correspond to various window managers and GUIs. You can use any of those, if you like.
Many X programs use a system called the X Resource Database to get various user preferences (fonts, colours, etc.) This database is maintained via the xrdb(1) program, which you will likely never need to run directly. Instead, it is run in Slackware from the xinitrc. The file that xinitrc tells xrdb to source for options is ~/.Xresources. xrdb will also load ~/.Xdefaults, so either of these filenames will work. A minimal .Xresources file looks like this:
xterm*background: black xterm*foreground: gray xterm*scrollBar: true xterm*font: -*-lucidatypewriter-*-r-*-*-15-*-*-*-*-*-*-* |
These four lines specify configuration information for the xterm program. An X resource is listed as follows:
program*option: setting/value |
Thus, the sample .Xresources above should be fairly self-explanatory. Don't be thrown off by the “font” line; X fonts are always specified that way.