Controlling X Applications with .Xresources

The X Window System also has many built-in customization features. Many X applications are programmed with a variety of resources, which are configuration settings that can be externally manipulated. Rather than have a configuration utility built into each application, applications can be written to examine the contents of a file in the user’s home directory. The .Xresources file contains a line for each configured resource in the following form:

program*resource: value

This line can be translated as follows:

  • program is the name of a configurable program, such as emacs or xterm.

  • resource is one of the configurable settings allowed by the program, such as colors.

  • value is the setting to apply to the resource.

For example, the following is an excerpt from .Xresources that configures colors for an xterm:

xterm*background: Black
xterm*foreground: Wheat
xterm*cursorColor: Orchid
xterm*reverseVideo: false

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.