-->
Previous Table of Contents Next


In our case, we use xsetroot to change the screen’s background color and then launch oclock, a rounded clock, the fvwm window manager, and two xterms. No matter what, you need a window manager program, to control the display. The default window manager on Linux is called fvwm (see Figure 3.1) and you’ll find it highly customizable.

X quits when the last program in the .xinitrc (system or local) stops. Often, this last program is preceded by an exec statement. When you quit this last program, X stops and you’re back at the console. In our case, we use fvwm as this last—key—process, because you need a window manager running during your entire X session, making fvwm a natural for this last process.

All our customizations to the .xinitrc file fit into a few simple lines:


  # Start X applications

  xsetroot -solid bisque3

  /usr/bin/X11/oclock -geom 100x100+0+6   &

  /usr/bin/X11/xterm -ls -geom 80x24+3+372 &

  /usr/bin/X11/xterm -ls -geom 80x48+264+13 &

  exec fvwm

The full .xinitrc file will look something like the following:


  #!/bin/sh

  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

  xsetroot -solid SteelBlue



  # Changed lines are below.

  xterm -geom 80x32+264+0 -ls &

  xterm -geom 80x32+0+250 -ls &

  oclock -geom -7-7 &

  exec fvwm

If you don’t set up a .xinitrc file and there is no system one, the default behavior is to create a single xterm window in the top-left corner of the screen. This xterm then becomes the key process, even if you later launch a window manager. When this xterm exits, X exits.

Chances are you can start with the above file and customize it to your needs later.

Stopping X

To stop X in the no .xinitrc file configuration, you need to find the xterm window that started out in the upper-left corner (you might have moved it) and exit it. You’ll soon be out of X and back to the boring old terminal mode.

If you use a .xinitrc file, simply exit the window manager to exit X. Normally, you can exit the window manager from a menu called up by placing the mouse over an empty area of the screen and holding down the leftmost mouse button. If this doesn’t work, try any and all mouse buttons.

Tuning Your Modes

It’s likely that the default mode in the XF86Config file will specify a 640-by-480 resolution. Chances are your hardware supports much higher resolutions. While running X, you can press Ctrl-Alt-Keypad-+ to switch to the next mode in the XF86Config file.

This is very useful, because the way X comes up may not look like a normal screen. If this is the case, try switching modes to see if things get better.

You can also change the XF86Config file to start up in the best mode. Look for the Screen section in your XF86Config file. You’ll want to change the modes line from something like:


  Modes "640x480" "800x600" "1024x768"

to


  Modes "1024x768" "800x600" "640x480"

Note that we merely put the best mode first. This makes XFree86 start up in 1024-by-768-pixel-resolution mode, a much nicer display mode, especially for X. Before doing this, though, make sure that all graphics modes work by using Ctrl-Alt-Keypad-+ while X is running. Ensure that each change results in a valid display.

VGA to the Rescue

If all the preceding methods have failed, you may want to fall back on VGA, just to get X up and running. This is presuming, of course, that you don’t have a plain old Super VGA card, for which the Super VGA modes would be most appropriate. Instead, the theory is that if you can’t get your super-duper card to run X in its super-duper accelerated mode, maybe you can get it running in plain old VGA. Most PC graphics boards support the VGA modes, so this method, while it won’t take advantage of the power of your graphics card, may at least allow you to run X if you can’t so far.

In the next section, we’ll show how to get a generic VGA file built. This step is usually much quicker than getting the file properly built for your graphics hardware.


WARNING:  Setting up XFree86 incorrectly can harm your system hardware, so watch out.

Using the Default Super VGA

In this section, we discuss using the sample Super VGA XF86Config file that comes with XFree86. You should always set up the XF86Config file for your exact hardware configuration. We only mention this technique because setting up X can prove to be nearly impossible. It is always best to set up X for your hardware. Remember, you were warned.

The first thing to do is find the example XF86Config file that comes with XFree86. This file, usually named XF86Config.eg and stored in /usr/X11R6/lib/X11, has the default mode for a 640-by-480-pixel Super VGA device. Most PC graphics boards support this mode, so you might be in luck.

Copy the XF86Config.eg file and edit it. You’ll need to add the data about your mouse and monitor. In fact, the more you can fill in, the better. When you’re done, you can copy this file to XF86Config and start up X. If you do use the Super VGA example file, you must use this X server. (Unless you have an Accel screen section set up, none of the accelerated X servers will work.)

Remember that running X this way may damage your hardware (don’t say we didn’t warn you). The only reason you want to run in a lower-resolution mode is if all else fails.

Again, it’s best to configure X for your hardware. Only try the Super VGA mode if you have a card for which all else fails (unless, of course, your graphics card is a Super VGA card and the XF86_SVGA program is the appropriate X server).

If you’re still having problems with X, you may want to look for extra help on the Internet.


Previous Table of Contents Next