Linux
by Kamran Husain
IN THIS CHAPTER
- The XF86Config File
- Modifying XF86Config
- Examining the XF86Config File
- The .xinitrc File
- The Personal X Resource File
- Using xdm
- Configuration of the Window Manager
- Compiling Programs That Use X
- Compiling Sources for XFree86
- Configuring fvwm
This chapter details the way to configure the X Window system for Linux. This
version of X Window for Linux is called XFree86 Version 3.1.2.
This chapter covers the following topics with regard to configuring your X Window
system:
- Working with the XF86Config file
- What the .xinitrc file is
- Your personal X resource file
- Using xdm
- Configuration of the window manager
In the preceding chapter you covered details of how to install X on your Linux
machine. Now, this chapter covers another one of the most difficult, time-consuming,
and frustrating parts of installing XFree86: setting up an XF86Config file.
To be able to set up an XF86Config file, you need to read the following
files from /usr/X386/lib/X11/etc: README, README.Config,
VideoModes.doc, and README.Linux. You also need to read the man
pages on the following topics: XF86Config, XFree86, XFree86kbd, and the server you
are using.
The XF86Config file is looked for by the X server in this order:
- In /usr/X386/lib/X11. This is the standard location for the sample XF86Config
file, but in some cases you cannot use it (for example, a read-only /usr
partition).
- In /etc.
- In your home directory.
- As XF86Config.eg in /usr/X386/lib/X11.
There might be a link from one of the places in the preceding list to /usr/X386/lib/X11.
To give you some hints, here is a list of what you need in order to set up the
XF86Config file correctly:
- You have to select the server suitable for your system. To get a hint as to which
is the correct server, run the SuperProbe program that comes with XFree86. After
SuperProbe identifies your chip set, you can look at the XFree86-HOWTO file
on the CD-ROM at the back of this book to see which server supports this chip set.
Note that SuperProbe can detect far more hardware than XFree86 supports.
- Your monitor's specifications, the most important of which are the maximum horizontal
and vertical scan frequency ranges and the bandwidth. This information can be obtained
from your monitor's datasheet.
- The name of the chip set for your video card. For example, the name might be
WD/Paradise, Tseng Labs, ET3000, or ET4000.
- The available dot clocks for your card or (if supported) the name of the programmable
dot clock generator. Learn how to obtain these by reading the file /usr/X386/lib/X11/doc/README.Config.
- The mouse type. "Mouse type" refers to the protocol the mouse is using,
not to the manufacturer. For example, a serial Microsoft mouse connected to the PS/2
port uses the PS/2 protocol, not the Microsoft protocol.
- The type of device your mouse is connected to: serial or bus. (Usually you can
use /dev/mouse.)
- Whether you want to use a national keyboard map or whether you want to run the
generic U.S. key table.
-
CAUTION: Do not share
XF86Config files with people who do not have the same configuration (graphics
card and monitor). By sharing, you could fry your or their monitor. It isn't so hard
to figure out modes for multisync monitors. Don't ever use a mode that you haven't
verified as being within your monitor's specs. Even if you have exactly the same
setup as the computer you're sharing the file with, check all modes before trying
them. Many people run their computers from specs that don't damage their hardware
but could damage yours.
XF86Config is located in /usr/X386/lib/X11/XF86Config. In most
cases, you should be able to modify this file yourself. In the improbable, though
not unlikely, event that the specifications for your monitor and card are not readily
available, you might have to use the ConfigXF86 and the xvidtune
utility from www.xfree86.org. See Chapter 21, "Installing XFree86."
The xvidtune utility provides an easy interface to the database of tested
graphics cards and monitors. It also has some tools for correctly configuring your
XF86Config file. The documentation and instructions for using xvidtune
are in an HTML file titled "Running xvidtune." This file is located
at
http://www.xfree86.org/3.2/QuickStart-6.html
If the XF86Setup utility does not work just right for you, you will have
to modify the XF86Config file yourself. This manual modification is what
this section concentrates on. Also note that running the XF86Setup utility
overwrites changes to the XF86Config file and could possibly overwrite your
manual edits. So keep a backup copy of the XF86Config file as a precaution.
-
TIP: The XFree86 servers
parse the XF86Config file in case-insensitive mode, so don't worry about
capitalization.
So now you have decided to modify the XF86Config file yourself. This
file contains all the configuration parameters for your X Window installation. Space
does not permit me to print the whole file. You will have to look in the directory
/usr/lib/X11 for the XF86Config.eg file. Copy this XF86Config.eg
file to XF86Config. Then edit the XF86Config file. The format
of the XF86Config file consists of different sets that are listed in the
following sections:
- Pathnames to font files
- Keyboard information
- Mouse and pointer information
- Monitor specifications
- Device and screen modes
Each of these sections describes your hardware configuration, location of files,
or both, to the X server. Each section looks like this:
Section "SectionName"
< information for the section >
EndSection
There is no reason to fiddle with the standard paths as provided in the sample
XF86Config file. In fact, any Linux distribution that provides strange paths
will also have edited this section of the XF86Config.eg or the template
XF86Config file for ConfigXF86. You do have to know where these
paths are pointing to in case of difficulties.
Your XF86Config file should look similar to my XF86Config file,
as shown in Listing 22.1.
#
# Multiple FontPath entries are allowed (which are concatenated together),
# as well as specifying multiple comma-separated entries in one FontPath
# command (or a combination of both methods)
#
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
# FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
To see whether these lines are correct, look into each of the directories mentioned
in List- ing 22.1 to see whether they have files in them. If these directories are
empty, you do not have the fonts installed, or they might be at another location.
You should specify the ServerNumlock option in this section if it is
not already defined. This is an easy way to specify your keyboard for XFree86. Otherwise,
only those keyboard modifications needed for international keyboard support must
be set manually. In a typical XConfig file, this section looks like the
one shown in Listing 22.2.
#
# Keyboard and various keyboard-related parameters
#
Section "Keyboard"
AutoRepeat 500 5
ServerNumLock
# Xleds 1 2 3
# DontZap
#
# To set the LeftAlt to Meta, RightAlt key to ModeShift,
# RightCtl key to Compose, and ScrollLock key to ModeLock:
#
# LeftAlt Meta
# RightCtl Compose
# ScrollLock ModeLock
# EndSection
The pointer section keyword is the name for the protocol the mouse uses. The available
protocol names are listed in the XF86Config man page.
The Logitech serial mouse uses several keywords. The MouseMan uses the MouseMan
keyword. The more recent Logitech serial mouse uses the Microsoft keyword.
The older Logitech serial mouse uses the Logitech keyword.
Any mouse connected to the PS/2 port uses the PS/2 keyword even if it
is in fact a serial mouse.
-
TIP: If you are not sure
which kind of bus mouse you have, look at the kernel's startup messages. It identifies
the bus mouse type.
-
CAUTION: Ensure that
the kernel bus mouse driver is using the same IRQ as the bus mouse. If not, you must
change the IRQ and rebuild the kernel. The IRQ for bus mouse devices is given in
- /usr/src/linux/include/linux/busmouse.h
The macro MOUSE_IRQ contains this IRQ and is set to 5 by default.
Following is a list of device names for the mouse selection:
- /dev/inportbm--Use this for the Microsoft bus mouse. Note that this
uses the Bus Mouse protocol, not the Microsoft protocol.
- /dev/logibm--Use this for the Logitech bus mouse. Note that this uses
the Bus Mouse protocol, not the Logitech protocol.
- /dev/psaux--Select this for a PS/2 or quick port mouse. This uses the
PS/2 protocol.
- /dev/atibm--Use this for the ATI XL bus mouse. Note that the ATI GU
bus mouse is a Logitech or Microsoft bus mouse, depending on the version you have.
- Other supported mice are serial mice; therefore, the device names are the same
as the serial devices (/dev/ttyS? or /dev/ttyS?? for Linux).
-
TIP: If you have a two-button
mouse, you might want to emulate the third button by setting Emulate3Buttons
in the mouse section. Emulation is accomplished by a press of both buttons simultaneously.
Many other settings are available, but they usually are not needed. Look at the XF86Config
man page for a list of available settings.
You have to select one type of mouse and its baud rate if it's serial. Note in
Listing 22.3 that I have "uncommented" the Microsoft mouse selection for
my mouse and the 1200-baud-rate line. You will have to uncomment the line that matches
your mouse selection. The 1200-baud rate seems to work fine with older mice, and
using the 9600 rate did not result in a speed difference for newer mice. (Actually,
the 9600 rate did not work with my mouse at all.) Your results might vary.
#
Section "Pointer"
# Mouse definition and related parameters
#
#MouseSystems "/dev/mouse"
Microsoft "/dev/mouse"
#MMSeries "/dev/mouse"
#Logitech "/dev/mouse"
#MouseMan "/dev/mouse"
#Busmouse "/dev/mouse"
BaudRate 1200
# BaudRate 9600
# SampleRate 150
# Emulate3Buttons
... <deleted some stuff here > ..
EndSection
If you want to identify the chip set your graphics card uses, run SuperProbe,
a program that comes with XFree86 and is capable of identifying a wide range of graphics
hardware. Note that SuperProbe can probe far more hardware than XFree86 supports.
Listing 22.4 shows a plain setting for a 640x480 monitor for X with a virtual
space of 800x600. A virtual space is an area where the display portion of your monitor
is mapped onto. Your monitor is a window into this space.
#
# First the 8-bit color SVGA driver
#
vga256
#
# To disable SpeedUp, use NoSpeedUp
#
# NoSpeedUp
# Virtual 1152 900
# Virtual 800 600
Virtual 640 480
ViewPort 0 0
# Modes "640x480" "800x600" "1024x768"
# Modes "640x480" "800x600"
Modes "640x480"
#
# Next the 1-bit mono SVGA driver
#
vga2
Virtual 800 600
ViewPort 0 0
Modes "640x480"
# Modes "800x600" "640x480"
This is the hardest part. If your monitor is not in the database, choose the generic
modes (VGA and 640x480) and start making your own modes from there. The VideoModes.doc
file in /usr/lib/X11/docs is a very detailed document on how monitors work.
It should help you determine which parameters you need for this section.
-
NOTE: I know that this
entire chapter is full of warnings, but don't be alarmed. Just be careful and read
the instructions for each step before taking it.
The xvidtune program is a neat utility to tune video modes. The modes
listed after running this utility might not work in all cases. You still have to
check the mode data against your monitor's data sheet and specifications before actually
testing the mode. The first line of the tuning mode's screen gives you information
on the specifications of the mode. You have to continuously check that these values
are within your monitor's capabilities before testing that mode.
See Listing 22.5 for the common video modes for XFree86.
Section "Device"
Identifier "Generic VGA"
VendorName "Unknown"
BoardName "Unknown"
ChipSet "generic"
# VideoRam 256
# Clocks 25.2 28.3
EndSection
# **********************************************************************
# Screen sections
# **********************************************************************
# The colour SVGA server
Section "Screen"
Driver "svga"
Device "Generic SVGA"
Monitor "Generic Monitor"
Subsection "Display"
Depth 8
Modes "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
EndSection
# The 16-colour VGA server
Section "Screen"
Driver "vga16"
Device "Generic VGA"
Monitor "Generic Monitor"
Subsection "Display"
Modes "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
EndSection
# The Mono server
Section "Screen"
Driver "vga2"
Device "Generic VGA"
Monitor "Generic Monitor"
Subsection "Display"
Modes "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
EndSection
The Modes line in a video section can have up to 10 values. Be very careful
when modifying these values because a wrong setting might wind up destroying your
monitor! It does not matter if these values are not present because defaults can
be used. This would be a typical line to override defaults for a monitor:
"640x400" 28 640 480 728 776 480 480 482 494
The 10 values in order from left to right are shown in the following section.
These values make sense only to video engineers or those folks who have to work with
a monitor not defined in the default modes. Check your monitor's hardware specifications,
and get the values from there to fill in these 10 parameters. These are the fields
to set:
- The label for screen resolution; for example, 640x480 or 1024x768.
- The clock frequency in MHz.
- The Horizontal Display End in number of visible dots per line on the screen.
- The Start Horizontal Retrace value. Specifies the number of pulses before the
video sync pulse starts.
- The End Horizontal Retrace value. Defines the end of the sync pulse.
- The Horizontal Total value. The total number of dots per line invisible and visible.
- The Vertical Display End value. The number of visible lines on the screen.
- The Start Vertical Retrace value. The number of lines before the sync pulse starts.
- The End Vertical Retrace value. The number of lines at the end of the sync pulse.
- The Vertical Total value. The total number of lines, invisible plus visible,
on the screen.
Multiscan monitors handle frequencies of 15 to 40 MHz. Some monitors work at a
72 MHz vertical scan to prevent the flicker. You have to be able to calculate the
frequency from the monitor's specification and come up with these numbers. A good
place to start would be the XFree86-HOWTO document on how to get these values.
Keep in mind that your video monitor is just a glorified television. You give it
wrong values, and you can fry it.
XFree86 servers are able to read the key table from the Linux kernel, so you need
to set up only one keyboard layout file (for the kernel). There are some restrictions,
though; the kernel can support more keyboard functions than X11. X11 can modify only
one of the four key tables. This modifier is called ModeShift.
Configurable keys for the ModeShift modifier are LeftAlt, RightAlt (sometimes
referred to as AltGr), RightCtl, and ScrollLock.
Usually, the AltGr key is used for international keyboard modifications. To enable
the XFree86 server to read the RightAlt key table from the kernel, you should put
the following line in the .xinitrc file:
RightAlt "ModeShift"
Besides supporting only one additional key map, X11 cannot use dead keys. A key
is called dead if, when it is typed, it does not print a character until a second
character is typed. A typical example is an accent key. Such keys are not supported
by X11, so you need to replace all dead key symbols with non-dead equivalents. Table
22.1 lists what you have to change.
Table 22.1. Key symbols.
Dead |
Non-Dead |
dead_tilde |
ASCII tilde |
dead_grave |
grave |
dead_circumflex |
ASCII circum |
dead_acute |
apostrophe |
dead_diaeresis |
dieresis |
Instead of supporting dead keys, XFree86 supports a Compose key. This feature
is described in the XFree86kbd man page. You can modify this feature by
assigning the Compose function to one of the keys. By default, the ScrollLock
key has the Compose function.
If you still want to have the dead keys on the console, you must use an xmodmap
file to map the keys to the correct symbols under X. This is also the method that
must be used with earlier versions of XFree86. On sunsite in the directory
/pub/Linux/X11/misc, you can find sample xmodmap files for several
languages. Note that you have to set the ModeShift modifier to get the right
key table working.
Read the kbd.FAQ that comes with the kbd package for Linux.
You will find many hints for modifying your keyboard layout on the console, as well
as for X.
To use X, you need a startup file that calls the local modifications, the window
manager, and an application you want to use right after X has started. If you are
using startx (or runx) to start X, this startup file is called
xinitrc. There is a standard xinitrc file, /usr/lib/X11/xinit/xinitrc,
which is the traditional location for this file. The Linux file system standard in
setup places this file in /etc/X11/xinit/xinitrc to allow a read-only
mounted /usr partition, so look at that location first.
If you are not content with what this file does (for instance, if you want to
use a different window manager), you should copy it to the file .xinitrc
in your home directory. After copying the file, you can edit it. Look at
the man pages for startx and xinit for more information.
Note that both the .xinitrc and the .Xresources files must be
readable and executable, so run the following command on these files after editing
them. You have to run the chmod command only once on the application.
$ chmod u+rx .xinitrc .Xresources
This command makes these files executable.
Listing 22.6 shows a sample xinitrc file.
1 #!/bin/sh
2 # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
3 # modified by obz
4 userresources=$HOME/.Xresources
5 usermodmap=$HOME/.Xmodmap
6 sysresources=/usr/lib/X11/xinit/.Xresources
7 sysmodmap=/usr/lib/X11/xinit/.Xmodmap
8 # merge in defaults and keymaps
9 if [ -f $sysresources ]; then
10 xrdb -merge $sysresources
11 fi
12 if [ -f $sysmodmap ]; then
13 xmodmap $sysmodmap
14 fi
15 if [ -f $userresources ]; then
16 xrdb -merge $userresources
17 fi
18 if [ -f $usermodmap ]; then
19 xmodmap $usermodmap
20 fi
21 # Set the background to a dull gray
22 if [ -f /usr/bin/X11/xsetroot ]; then
23 xsetroot -solid gray32
24 fi
25 if [ -f /usr/bin/X11/xclock ]; then
26 xclock -geometry 80x80 &
27 fi
28 olvwm &
29 # fvwm &
30 xterm -e /bin/bash
The line numbers in this listing have been added for your benefit. Let's look
at these lines in greater detail.
Lines 4-7 set the resource environment variables for the X Window installation
for your system. Change these to the path of your system's X Window system distribution.
Lines 9-20 check for the existence of these resources and then run the appropriate
program, xmodmap or xrdb, with these resources as parameters. I cover both xmodmap
and xrdb in Chapter 23, "Using Motif." For now, you can use this the way
it stands.
Lines 22-24 check for the xsetroot program. If it's present, these lines execute
it to set the background to a solid color, gray32.
The olvwm & command in line 28 starts the OPEN LOOK window manager.
If you want to use fvwm instead of olvwm, uncomment line 29 and
comment line 28 instead. The window manager must be run in the background if you
have more commands following this one.
Line 30 starts a terminal to work with. Because this is the last line in the .xinitrc
file, exiting this terminal causes your X session to stop. If you want to start more
xterms, you can start them from within this xterm.
A simpler .xinitrc file to start with would be this:
xterm -name Console &
olvwm
You can then enhance this .xinitrc file with what you want.
Sometimes you won't be content with default settings for applications that don't
have a configuration file of their own. You can change some of these defaults by
setting X resources in the .Xresources file in your home directory.
-
NOTE: You should know
what effects setting the resources will have on the programs you use. Read the man
pages for the program and for xrdb before editing the Xresources file. See
Chapter 2, "Types of Linux," and Chapter 25, "Ghostscript," for
more information about X resources.
A resource file looks like an application default file. The difference is that
in the resource file, resources for several applications are set. You should use
the full names (Progname.Resourcename) instead of abbreviating the program name with
an asterisk. Examples of application default files can be found in the /usr/X386/lib/X11/app-defaults
directory. The resources available for a single application are usually shown in
the man pages for that application.
If you are running a color server, you might want to put the following lines into
your .Xresources file if some programs start in black and white:
#ifdef COLOR
*customization: -color
#endif
If this change is made, the program Foo will read both the Foo and the Foo-color
application default file from /usr/X386/lib/X11/app-defaults. The usual
behavior is for Foo only to be read.
- NOTE: If you are running a color server, the
preceding code definitely should be added to the system Xresources file.
You might mention that to whomever maintains the program you are running.
Note that the black-and-white color scheme of a program might be caused by the
program rather than its resources.
The -xrm can be used with most X programs to override the parameters
set in your .Xresources file. The usage is
-xrm "resource"
Alternatively, you can use the xrdb filename command to make any changes
you have made in filename apply to your current session.
If you want to run X on your system all the time, you could run xdm from the system
startup. xdm is preconfigured on most systems, so you should not have to edit any
of the xdm configuration files. You can run xdm from the command line at the console
while logged in as root.
Alternatively, you can use the initial /etc/rc.d scripts to run xdm for
you. You usually only have to remove comment signs at the beginning of a line that
calls xdm. If no such line is present, you probably have a system that has no preconfigured
xdm. In any event, xdm by default runs your .xinitrc file for you.
Window managers are a user- and site-specific issue. Several window managers are
available for Linux. The configuration of one window manager is quite different from
that of another. The window manager used in the configuration is usually explained
in your .xinitrc file, so look there. These are the most commonly used window
managers for Linux:
- olwm or olvwm for the OPEN LOOK window manager. (It is on the CD-ROM at the back
of this book.)
- mwm for the Motif window manager, possibly the most common commercial window
manager. You have to buy it along with Motif.
- twm. (It is part of the XFree86 distribution on the CD-ROM at the back of this
book.)
- fvwm, which seems to be the most popular shareware window manager. (It is on
the CD-ROM at the back of this book.) There is a Windows 95 look and feel for fvwm
called fvwm95.
I discuss some window managers in greater detail in the next couple of chapters
on OPEN LOOK and Motif.
Before compiling any programs for X, read the GCC-FAQ file. This file
can be found in the docs directories of sunsite and tsx-11
before any programs are compiled. Many questions on compiling programs with Linux
are answered in this FAQ. Many Linux distributions include the most relevant FAQs
in the directory /usr/doc, so you might look there first.
If you have the source code for a program that uses X11, it is usually shipped
with an imakefile rather than a makefile.
imakefiles are files that create makefiles for your system. Discussing imakefiles
is beyond the scope of this book; however, you will have to work with imakefiles
if you work at all with X sources. Just remember the shell script xmkmf,
and you should be OK.
-
TIP: xmkmf is
a abbreviation for X make makefile.
-
CAUTION: The xmkmf
shell script actually runs the imake command with a set of arguments. The
most common argument is the -DUseInstalled argument. If you examine xmkmf
(look in /usr/X11/bin/), you will see that the xmkmf script is
a basic wrapper around a call to imake. It's very tempting to use imake
on a command line by itself. Do not do so. Run the imake command with the
-DUseInstalled argument if you must run imake on the command line.
If you don't use this argument, imake behaves as if it were re-creating
the X Window system on your current directory.
Of course, before ever running xmkmf, you should read the documentation
that usually comes with such packages.
Run xmkmf in the directory that contains the imakefiles. If there is
a hierarchy of directories with imakefiles, you usually only have to run xmkmf
in the root directory of that hierarchy.
The xmkmf command builds the makefiles in all directories in the hierarchy.
You next should run the make command with an argument to let make
resolve its dependencies, using the following command:
$ make depend
-
TIP: Don't be afraid
if include files, such as stddef.h and varargs.h, are
not found. They are gcc proprietary header files and therefore are not in
the standard include directories.
After that, you can make the program by running make, and you
can install your new utility (usually in /usr/X386/bin) by running this
line:
$ make install
The installation of the man pages is usually done with this command:
$ make install.man
You do not typically want to compile sources for XFree86 unless you really want
to make changes to the sources because something is not working. You need a lot of
disk space and CPU time to do a complete build of the XFree86 system. You can find
anything you need to know for compiling XFree86 in the following files (in /usr/X386/lib/X11/etc):
INSTALL, README, and README.Linux.
To build a server that includes only those drivers you need, you should use the
LinkKit instead of compiling the complete system. This is a little easier
than trying to build XFree86 from scratch. The LinkKit package is too specific
and complicated and is therefore beyond the scope of this chapter.
You can find the documentation on how to build servers in the /usr/X386/lib/Server/VGADriverDoc
directory after installing the LinkKit package. Read /usr/X386/lib/Server/README
for a description of how to use LinkKit. This file is not included in the
standard XFree86 tar files but is part of the file that includes the LinkKit.
After you have installed Linux with X Window, chances are that you will want to
use the default window manager, fvwm, that comes with Linux. The fvwm supposedly
stands for either Free Virtual Window Manager or the Frugal Virtual Window Manager.
In the documentation, fvwm is referred to by its initials only and is conveniently
pronounced "F-V-W-M."
The fvwm is a good window manager that can be used in place of twm (Tom's window
manager), mwm (Motif window manager), and olvwm (OPEN LOOK virtual window manager).
This section will introduce you to the basics of configuring this window manager
for your use. You can get a lot more information specific to your X Window setup
by reading the man pages for fvwm.
Now there is a newer Windows 95 look-alike window manager called fvwm95. This
is included in the CD-ROM at the back of this book. If you miss Windows 95 (from
Microsoft), you can use this "Windows 95 look and feel" hack for Linux
that is available from sunsite.unc.edu in the /pub/Linux/X11/window-managers
directory. The latest version at the time of writing was fvwm95-2.0.43.tar.gz.
The tar archive includes documentation and installation instructions for this new
package. There are also detailed instructions in the package on how to convert from
fvwm to fvwm95. The configurations for your setup after conversion are then kept
in .fvwm2rc95 in your home directory.
This chapter covers the fvwm manager that is currently used more often.
When it is being initialized, fvwm relies on one of two files. The first file
fvwm looks for is the .fvwmrc file in the home directory of the user. If
this .fvwmrc file is not found, fvwm looks for the default configuration
file, /usr/lib/X11/fvwm/system.fvwmrc. If neither file exists or if the
file being read is not formatted correctly, fvwm stops processing and bails out with
a list of error messages.
-
TIP: Because fvwm is
very fickle about formats in its configuration file, always keep a working backup
copy of your .fvwmrc file before making changes. This way, you will have
something to fall back on if your changes crash fvwm.
Changes to customize your desktop can be made to either the .fvwmrc file
in your home directory or the system.fvwmrc file. If you make changes to
the system file, you will be affecting all other users on your machine who rely on
it. In general, you should copy the system.fvwmrc file to your home directory
as .fvwmrc and make changes there. The rest of this section assumes that
you are making changes to the .fvwmrc in your local directory. When you
are satisfied with your changes, you can elect to copy the .fvwmrc file
to the system.fvwmrc file. The /usr/lib/X11/fvwm directory requires
root privilege. Making the changes to system.fvwmrc is an administrative
task and is not left to individual users.
If you do not already have a ~./.fvwmrc file, create one with the following
command:
$ cp /usr/lib/X11/fvwm/system.fvwmrc ~/.fvwmrc
Now let's look at some basic components of the .fvwmrc file. These are
the basic components:
- Pop-up menu hierarchy
- Actions to take on startup
- Color definitions
- Customization styles
These components can be found in many locations in the .fvwmrc file.
The order of appearance in the .fvwmrc file, however, is based on the criterion
that you must define an object first before you can use it.
While running fvwm, you invoke the pop-up menus by clicking the left mouse button
on the background of the window. The default .fvwmrc file will come with
several options already set for you.
The best way to start is by example. An excerpt from my .fvwmrc file
is shown in Listing 22.7.
Popup "Applications"
Title "Applications"
Exec "&Netscape" exec /home/khusain/bin/n30/netscape &
Exec "X&V" exec xv &
Exec "X&edit" exec xedit &
Exec "X&fig" exec xfig &
Exec "Xf&m" exec xfm &
Exec "Xfilem&anager" exec xfilemanager &
Exec "X&grab" exec xgrab &
Exec "X&paint" exec xpaint &
Exec "Xsprea&d" exec xspread &
# Exec "Xxgdb" exec xxgdb &
EndPopup
This menu shows a pop-up window with options to select commands with. The Exec
keyword tells fvwm that it has to execute a command. The string following the Exec
keyword will be displayed on the pop-up menu item. The ampersand before a character
creates a shortcut key for that command. For example, "&Netscape"
will be displayed with the N underlined. Then when the pop-up menu window is displayed,
a press of the N key (either Shift-N or Shift-n, because case does not matter) will
start Netscape from the directory /home/khusain/bin/n30. All commented lines
begin with a hash (#; see the line for xxgdb) and are ignored by
fvwm.
It's important that all Exec-ed applications be started in the background.
This is why there is an ampersand at the end of the Netscape command. The title parameter
sets the string that will be displayed for the pop-up menu selection list. The string
following the Popup keyword is the name of this selection. Other pop-up
menus can then refer to this menu selection with the name Applications. Look at the
middle of the code shown in Listing 22.8, in the Utilities pop-up menu, to see where
the Applications pop-up is called out.
Popup "Utilities"
Title "Utilities"
Exec "Top" exec rxvt -font 7x14 -T Top -n Top -e top &
Exec "Calculator" exec xcalc &
Exec "Xman" exec xman &
Exec "Xmag" exec xmag &
Exec "Oclock" exec oclock &
Nop ""
Popup "Applications" Applications
Nop ""
Popup "Shells" Shells
Nop ""
Popup "Games" Games
Nop ""
Popup "Screensaver (a-h)" Screensaver1
Popup "Screensaver (i-z)" Screensaver2
Nop ""
Popup "Lock Screen (a-h)" Screenlock1
Popup "Lock Screen (i-z)" Screenlock2
Nop ""
Popup "Modules" Module-Popup
Nop ""
Popup "Exit Fvwm" Quit-Verify
Nop ""
Refresh "Refresh Screen"
EndPopup
Of course, menu items don't always have to do something for them to work. The
Nop command does "no operation." See the code in Listing 22.9
for the way fvwm quits back to a shell prompt. If the user selects the entry with
the title No, Don't Quit, no action is taken.
Popup "Quit-Verify"
Title "Really Quit Fvwm?"
Quit "Yes, Bail me outta here "
Restart "Restart Fvwm" fvwm
Restart "Start twm" twm
Restart "Start tvtwm" tvtwm
Restart "Start mwm" mwm
Restart "Start olvwm" /usr/openwin/bin/olvwm
Restart "Start olwm" /usr/openwin/bin/olwm
Nop ""
Nop "No, Don't Quit"
EndPopup
One more thing. To get a horizontal bar in the menu entries, use the Nop
command with an empty string (""). If you place a space in the
string (" ") an empty box is created instead. By using these two
alternatives, you can create pretty decent separators for menu items.
The InitFunction function in fvwm is the routine that is called by fvwm
when it initializes itself. The use of the InitFunction in fvwm is analogous
to that of the .xinitrc file in xinit: all startup components and modules
are loaded with this function in fvwm. The default entry for fvwm is shown in Listing
22.10. You can uncomment each line to enable it.
Function "InitFunction"
# Module "I" FvwmBanner
# Exec "I" xpmroot /usr/include/X11/pixmaps/fvwm.xpm &
# Module "I" GoodStuff
# Module "I" FvwmPager 0 3
# Exec "I" exec xterm -geometry 80x64+0+0 &
# Wait "I" xterm
# Desk "I" 0 2
# Exec "I" exec xmh -font fixed -geometry 507x750+0+0 &
# Wait "I" xmh
# Desk "I" 0 0
EndFunction
Each entry in the InitFunction generally consists of two lines. The second
line, if present, is a Wait function call. For example, a two-line entry
(often referred to as a "stanza") takes the following form:
Exec "I" exec command options &
Wait "I" command
The Wait command tells fvwm to wait until the command window is visible.
The Desk command forces fvwm to switch to a particular window on a desk.
By default, six virtual windows are available per desktop--two rows with three columns.
The Desk entry takes the desk and window of the virtual desktop to switch
to. The following lines fire up Netscape for me on the third window on desk 0 and
then switch back to the first desktop (desk 0, window 0) after the Netscape application
is visible. (See Chapter 61, "Using Browsers," for information on how to
get Netscape for Linux.)
Desk "I" 0 2
Exec "I" exec netscape &
Wait "I" netscape
Desk "I" 0 0
The Wait command is not necessary if all your initial programs are executed
on one window. The Wait command is required to force fvwm to wait for a
window to become fully visible on a desktop before switching to another desktop.
-
TIP: The Exec,
Wait, Desk, and Module commands require the "I"
string as the first parameter for fvwm to work correctly.
A module is something that communicates with fvwm directly via pipes. Modules
cannot be executed directly and must be started from within fvwm. This lets fvwm
create bidirectional communication through the use of a UNIX pipe mechanism. Modules
enhance the functionality of fvwm.
The FvwmWinList opens a window with the list of all windows available to you on
a screen. Figure 22.1 shows the windows listed on my desktop.
FIGURE
22.1. The FvwmWinList module window.
Several other modules come with fvwm, including the Pager module, which is really
a big desk/virtual window manager, and FvwmBanner, which displays a pixmap as a background
when it starts up. The Pager module lets you create several desks, each with its
own set of virtual windows. (See Figure 22.2.)
FIGURE
22.2. The Pager module default window.
You can customize the appearance of fvwm with a choice of your own set of colors
instead of using the default values. Here is a list of the colors you can set in
your .fvwmrc file:
- StdForeColor: Foreground color for nonselected window titles and menu
items.
- StdBackColor: Background color for nonselected window titles and menu
items.
- StickyForeColor: Foreground color for nonselected sticky window titles.
(Sticky windows always stay on the screen regardless of which desktop you happen
to be on.)
- StickyBackColor: Background color for nonselected sticky window titles.
- HiForeColor: Foreground color for selected window titles.
- HiBackColor: Background color for selected window titles.
- MenuForeColor: Foreground color for menu items.
- MenuBackColor: Background color for menu items.
- MenuStippleColor: Background color for shaded menu items.
- PagerForeColor: Foreground color for virtual window pager.
- PagerBackColor: Background color for virtual window pager.
You can define colors either by using the names found in the /usr/lib/X11/rgb.txt
file or by specifying the red, green, and blue color components using the format
#RRGGBB
where RR is the red component, GG is the green component, and BB is the blue component.
All components are hex values between 0 and 255 and are represented
as hex numbers. For example, the following definitions for a black color are equal:
StdForeColor black
StdForeColor #000000
For a grayscale color, you could use either of the following statements:
MenuForeColor gray138
MenuForeColor #8a8a8a
Colors are not the only way you can customize your desktop. A style is used to
define the type of a window. The way to define styles in fvwm is to use this syntax:
Style windowName options
The windowName can be specified to use a specific window or can be used with a
wildcard. For example, with xclock, the style will apply only to applications
called xclock. The term *clock will cause fvwm to apply the style to all
applications whose names end with "clock," such as oclock or xclock.
The options available for use with a style are listed here:
- Border/NoBorder: Specify whether to use a border.
- BorderWidth: Specify the width of the border, if there is a border.
- Title/NoTitle: Specify whether to use a title.
- StartsOnDesk #: Specify which desk to start on.
- Sticky: Make the window sticky.
- StaysOnTop: Always force this window to be active.
- Icon name: Use as icon pixmap.
- WindowListSkip: Don't list in lists for windows to tab over.
- CirculateSkip: Don't list in circular lists.
- SuppressIcons: Don't allow iconic version.
- NoHandles: Disable resizing capability.
- boundaryWidth/NoBoundaryWidth: Specify boundary width.
- StdForeColor: Set foreground color.
- StdBackColor: Set background color.
Listing 22.11 shows the styles that come as a default setup with the system.fvwmrc
file.
Style "*" BorderWidth 5, HandleWidth 5, Color Black/#60a0c0,Icon unknown1.xpm
Style "Fvwm*" NoTitle, Sticky, WindowListSkip
Style "Fvwm Pager" StaysOnTop
Style "FvwmBanner" StaysOnTop
Style "GoodStuff" NoTitle, NoHandles, Sticky, WindowListSkip, BorderWidth 0
Style "*lock" NoTitle, NoHandles, Sticky, WindowListSkip
Style "xbiff" NoTitle, Sticky, WindowListSkip
Style "Maker" StartsOnDesk 1
Style "matlab" StartsOnDesk 3
Style "signal" StartsOnDesk 3
Style "rxvt" Icon term.xpm
Style "xterm" Icon xterm.xpm, Color black/grey
Style "Appointment" Icon datebook.xpm
Style "xcalc" Icon xcalc.xpm
Style "xbiff" Icon mail1.xpm
Style "xmh" Icon mail1.xpm, StartsOnDesk 2
Style "xman" Icon xman.xpm
Style "xvgr" Icon graphs.xpm
Style "matlab" Icon math4.xpm
Style "xmag" Icon mag_glass.xpm
Style "xgraph" Icon graphs.xpm
Style "GoodStuff" Icon toolbox.xpm
As you can see, several styles come with the fvwm to get you started. Just copy
the system-wide file over to your home directory, and edit away.
The man pages for fvwm provide a great deal of very specific information. There
are many other options and features for fvwm. Check the Web pages on the Internet
for more information on fvwm. Use "fvwm" or "fvwm home
page" as the string for search engines such as Yahoo!, Excite, or AltaVista.
I found more than 2,000 entries the last time I checked! Here are some of the pages
to look at as starting points:
http://www.cs.hmu.edu/~tkelly/docs/fvwm.html
http://www.cobaltgroup.com/~roland/fvwm/fvwm.html
This chapter covered the topic of configuring the XFree86 system. After reading
this chapter, you should have an idea of how to set up your XF86Config file
to generate your X environment. Just remember to start with the basic configuration
settings for VGA cards and then make enhancements. Keep backups of your work, and
do not change the video settings unless you know what you're doing. If nothing works
despite your best efforts, you have the recourse of knowing where to look for answers
in FAQs, newsgroups, and FTP sites on the Internet for HOWTO and other documents
on Linux.
Contact
reference@developer.com with questions or comments.
Copyright 1998
EarthWeb Inc., All rights reserved.
PLEASE READ THE ACCEPTABLE USAGE STATEMENT.
Copyright 1998 Macmillan Computer Publishing. All rights reserved.