Configuring X Windows
Most configuration of X Windows is handled by a server resource database. When a client makes a request of the server, the server checks this database to determine user preferences for that client. The server resource database is loaded on a per-user basis via the command xrdb, which needs to be executed automatically after starting X11. xrdb loads configuration information from a dot file usually named .X11defaults. (Dot files are discussed in Lesson 16, “Modifying the User Environment.”) .X11defaults usually contains lines similar to the following:
xbiff*onceOnly: on xbiff*wm_option.autoRaise: off xbiff*mailBox: /usr/spool/mail/mymail
If you include these lines in your .X11defaults file, you are telling your X server that if xbiff (an X11 program that notifies you when you have new mail) starts, it needs to set certain options:
Because each client supports different options and allows the window manager different levels of control, you’ll need to consult each client’s documentation to learn what you can configure and what you need to do to configure it.
In addition to the server resources database, clients frequently have command-line options that can control the client’s interaction with X11. Take a look at the following command:
> xterm -fg "black" -bg "white" -fn 6x10 -geometry 85x30+525+1
This starts an xterm session with the following configuration: black as the foreground color, white as the background color (black text on a white window), and a 6×10 point font. It also sets the geometry information such that the window is 85 characters wide, 30 characters high, and placed 525 pixels from the left edge of the screen and 1 pixel down from the top.
Again, different programs have different options available and your local documentation is your best source for up-to-date information on your exact configuration.
Because X Windows provides only rudimentary user-interface-component display functionality, an additional program is required to provide a useful user interface. This program is the window manager. Depending on the variation of UNIX you are running, you might have a number of options for different window managers. Each provides slightly different features with accordingly different strengths and weaknesses.
twm
One of the most common—and least-featured—window managers is twm. twm, shown managing the display in Figure 3.1, provides very basic window management functions and is present or available on almost all UNIX implementations. If you work in a multi-platform environment with different flavors of UNIX, you might find twm to be convenient because your configuration can be identical on all the machines. For its simplicity, twm also provides some of the best user extensibility of the interface. If you like, you can create your own standard buttons that appear in your twm title bars to execute arbitrary commands. You can also build your own pop-up menus, automatically execute commands when the cursor enters windows, customize window manager colors and actions by application name and type, and a host of other customizations. To start the twm window manager, execute twm after starting X (you can probably do this automatically in your .xinitrc file). The control file for all this customization is named .twmrc and is probably located in your home directory.
Figure 3.1 twm managing an X
Windows session.
As you can see in Figure 3.1, twm enables you to have a number of windows open at once. During window layering—even though windows might be partially covered by one another—you can focus input to the hidden windows, enabling you to work in any open window. Active applications that have been iconized can be clicked to be returned to their normal size.
Other Window Managers
Other window managers you might encounter depending on the variation of UNIX you are running include
There are many other window managers, and a variety will most likely be available to you for use on your machine. After you’ve investigated your options, you can start building a custom environment that feels and behaves exactly as you want it to.
Remember, it is the window manager that provides user-interface features such as title bars. If you find yourself facing a screen which looks like Figure 3.2 (windows missing title bars, no scroll bars, no icons) it is because there is no window manager running; it either hasn’t started for some reason, or it has crashed. You can try starting a window manager by typing twm—if there is a terminal window open that is accepting keyboard input (directing keyboard input to a particular window is also a window manager function). If not, you’ll need to exit the X Windows environment and modify your startup files to start the window manager of your choice immediately after starting the X server.
Figure 3.2 This X Windows session has
lost its window manager.