Graphical Environment  «Prev  Next»
Lesson 3 Customizing X applications
Objective Use the .Xdefaults file to customize the look and feel of X applications.

Customizing X Applications in Red Hat

Users want a configurable GUI. They want to customize default border sizes, title-bars , and colors for their X applications. By editing a simple text file in their home directory, .Xdefaults, Linux users can customize all parts of their X windows session.
  1. Title-bar: Part of a window border that is located at the top of the window and is used to drag the window and access window modification commands such as minimize and Shade. Shade retracts the window, leaving the title-bar in its place.
  2. Xdefaults :A standard filename used to specify X resources.

Setting Resources by Class

Every line in the .Xdefaults file sets preferences for specific applications or entire classes of applications. A typical line found in a user's .Xdefaults file might be:
Xterm*background: black

Xterm is the class name of all X terminal applications. You refer to specific options after the asterisk (*). In the example above, *background sets the background color attribute. The colon sets the resource to the value you supply, which in this case is black. Reading from left to right, this resource sets all X terminals' backgrounds to black.

Setting resources by Application

If you only wish to set resources for a particular application, simply use the application's name instead of its class.
For example, let us say you are using xterm and kterm, which both have black backgrounds because of the Xterm class resource just set. You prefer blue text in your xterm, but want to keep the default text color in kterm. To set xterm's foreground, but leave kterm's alone, you only add this resource line:

xterm*foreground: blue

The following diagram shows examples of other resources you may want to set in the command line format. Check the X man page for a complete list of resources.
geometry resource in this line tells all applications of class Xcalc
  1. The geometry resource in this line tells all applications of class Xcalc to originate the lower right-hand portion of the screen.
  2. The cursorColor resource changes the cursor's color in all Xterm class terminal windows to blue.
  3. xload is an application that shows system load overtime in an easy-to-read bar graph. These two command lines set the graph to red on white for all applications in the Xload class.
  4. By setting the border to 0, the border around xload will disappear, which decreases its footprint on the root window. Applications that are members of Xload, other than xload itself, will still have a visible border.

Using xdefault file
Because Linux was created as a multiuser computer system, you start by logging in (even if you are the only person using the computer). Logging in accomplishes three functions:
  1. It identifies you as a particular user.
  2. It starts up your own shell and desktop (icons, panels, backgrounds, and so on) configurations.
  3. It gives you appropriate permissions to change files and run programs.
After the computer has been turned on and the operating system has started, you see either a graphical login screen (default) or a text-based login prompt. The text-based prompt should look something like this:
Fedora release 11
Kernel 2.6.29 on an i686
localhost login:
The next lesson shows you how to use the GNOME Display Manager to manage X sessions.