next up previous contents index
Next: Twm Configuration Up: I Gotta Be Me! Previous: Environment Variables

The X Window System Init Files


-0.55in Most people prefer to do their work inside a graphical environment, and for Unix machines, that usually means using X. If you're accustomed to the Macintosh  or to Microsoft Windows , the X Window System may take a little getting used to, especially in how it is customized.

With the Macintosh or Microsoft Windows, you customize the environment from within the environment: if you want to change your background, for example, you do by clicking on the new color in some special graphical setup program. In X, system defaults are controlled by text files, which you edit directly--in other words, you'd type the actual color name into a file in order to set your background to that color.

There is no denying that this method just isn't as slick as some commercial windowing systems. I think this tendency to remain text-based, even in a graphical environment, has to do with the fact that X was created by a bunch of programmers who simply weren't trying to write software that their grandparents could use. This tendency may change in future versions of X (at least I hope it will), but for now, you just have to learn to deal with more text files. It does at least give you very flexible and precise control over your configuration.

Here are the most important files for configuring X:

All of these files should be located in your home directory, if they exist at all.

The .xinitrc is a simple shell script that gets run when X is invoked. It can do anything any other shell script can do, but of course it makes the most sense to use it for starting up various X programs and setting window system parameters. The last command in the .xinitrc is usually the name of a window manager to run, for example /usr/bin/X11/twm.

What sort of thing might you want to put in a .xinitrc file? Perhaps some calls to the xsetroot program, to make your root (background) window and mouse cursor look the way you want them to look. Calls to xmodmap, which tells the servergif how to interpret the signals from your keyboard. Any other programs you want started every time you run X (for example, xclock).

Here is some of my .xinitrc; yours will almost certainly look different, so this is meant only as an example:


Notice that some commands are run in the background (i.e.: they are followed with a ``&''), while others aren't. The distinction is that some programs will start when you start X and keep going until you exit--these get put in the background. Others execute once and then exit immediately. xsetroot is one such; it just sets the root window or cursor or whatever, and then exits.

Once the window manager has started, it will read its own init file, which controls things like how your menus are set up, which positions windows are brought up at, icon control, and other earth-shakingly important issues. If you use twm, then this file is .twmrc in your home directory. If you use fvwm, then it's .fvwmrc, etc. I'll deal with only those two, since they're the window managers you'll be most likely to encounter with Linux.

next up previous contents index
Next: Twm Configuration Up: I Gotta Be Me! Previous: Environment Variables

Converted on:
Mon Apr 1 08:59:56 EST 1996