[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 6

xrdb Command

Purpose

X Server resource database utilities.

Syntax

xrdb-display Display ] [  -help ] [  -quiet ] [  -retain ] [  -cpp FileName-nocpp ] [  -D Name=Value ] [  -I Directory] [  -U Name ] [  -all -global -screen -screens ] [  -n ] [  -edit  FileName | [  -backup String ] |  -merge FileName ] |  -load  [ FileName ] |  -query -remove | symbols ] -override ]

Description

The xrdb command gets or sets the contents of the RESOURCE_MANAGER property on the root window of screen 0 or the SCREEN_RESOURCES property on the root window of any or all screens, or everything combined. You normally run this program from your X startup file.

Most X clients use the RESOURCE_MANAGER and SCREEN_RESOURCES properties to get user preferences about color, fonts, and so on for applications. Having this information in the server (where it is available to all clients) instead of on disk solves the problem in previous versions of X that required you to maintain defaults files on every machine that you might use. It also allows for dynamic changing of defaults without editing files.

The RESOURCE_MANAGER property specifies resources that apply to all screens of the display. The SCREEN_RESOURCES property on each screen specifies additional (or overriding) resources to be used for that screen. (When there is only one screen, SCREEN_RESOURCES is normally not used; all resources are placed in the RESOURCE_MANAGER property.)

For compatibility, if there is no RESOURCE_MANAGER property defined (either because the xrdb command was not run or if the property was removed), the resource manager looks for a file called .Xdefaults in your home directory.

The file name (or the standard input if - or no file name is given) is optionally passed through the C preprocessor with the following symbols defined, based on the capabilities of the server being used:

SERVERHOST=Hostname Specifies the hostname portion of the display to which you are connected.
SRVR_name Turns the SERVERHOST hostname string into a legal identifier. For example my-dpy.lcs.mit.edu becomes SRVR_my_dpy_lcs_mit_edu.
HOST=Hostname Specifies the hostname portion of the display to which you are connected.
DISPLAY_NUM=num Specifies the number of the display on the server host.
CLIENTHOST=Hostname Specifies the name of the host on which xrdb is running.
CLNT_name Turns the CLIENTHOST hostname string into a legal identifier. For example expo.lcs.mit.edu becomes CLNT_expo_lcs_mit_edu.
WIDTH=Number Specifies the width of the default screen in pixels.
HEIGHT=Number Specifies the height of the default screen in pixels.
X_RESOLUTION=Number Specifies the x resolution of the default screen in pixels per meter.
Y_RESOLUTION=Number Specifies the y resolution of the default screen in pixels per meter.
PLANES=Number Specifies the number of bit planes (the depth) of the root window of the default screen.
RELEASE=Number Specifies the vendor release number for the server. The interpretation of this number varies depending on VENDOR.
REVISION=Number Specifies the X protocol minor version supported by this server (currently 0).
VERSION=Number Specifies the X protocol major version supported by this server (should always be 11).
VENDOR=Vendor A string specifying the vendor of the server.
VNDR_name Turns the VENDOR name string into a legal identifier. For example MIT X Consortium becomes VNDR_MIT_X_Consortium.
EXT_name Turns each extension string into a legal identifier. A symbol is defined for each protocol extension supported by the server. For example X3D-PEX becomes EXT_X3D_PEX.
NUM_SCREENS=num Specifies the total number of screens.
SCREEN_NUM=num Specifies the number of current screen. from 0 (zero).
BITS_PER_RGB=Number Specifies the number of significant bits in an RGB color specification. This is the log base 2 of the number of distinct shades of each primary that the hardware can generate. Note that it is not related to PLANES.
CLASS=VisualClass Specifies the visual class of the root window of the default screen which is one of the following:
CLASS_visualclass=visualid Specifies the visual class of the root window in a form can #ifdef on. The value is the numeric id of the visual.

DirectColor, GrayScale, PseudoColor, StaticColor, StaticGray, TrueColor

CLASS_visualclass_depth=num A symbol is defined for each visual supported for the screen. The symbol includes the class of the visual and its depth; the value is the numeric id of the visual. (If more than one visual has the same class and depth, the numeric id of the first one reported by the server is used.)S
COLOR Defined only if CLASS is one of StaticColor, PseudoColor, TrueColor, or DirectColor.

Comment lines begin with an ! (exclamation mark) and are ignored.

Since xrdb can be read from standard input, use it to change the contents of properties directly from a terminal or from a shell script.

Flags

-all Indicates that operation is performed on the screen-independent resource property (RESOURCE_MANAGER), as well as the screen-specific property (SCREEN_RESOURCES) on every screen of the display. For example, when used in conjunction with -query, the contents of all properties are output. For -load and -merge, the input file is processed once for each screen. The resources that occur in common in the output for every screen are collected and applied as the screen-independent resources. The remaining resources are applied for each individual per-screen property. This is the default mode of operation. This option is specific to X11R5.
-backup String Specifies a suffix to append to the file name. Use it with -edit to generate a backup file. -edit is a prerequisite for -backup String.
-cpp FileName Specifies the pathname of the C preprocessor program to use. Although the xrdb command was designed to use CPP, any program that acts as a filter and accepts the -D, -I, and -U flags can be used.
-DName=Value Passes through to the preprocessor and defines symbols to use with conditionals such as #ifdef.
-display Display Specifies the X Server to use. It also specifies the screen to use for the -screen option, and it specifies the screen from which preprocessor symbols are derived for the -global option.
-edit FileName Indicates that the contents of the specified properties should be edited into the given file, replacing any values listed there. This allows you to put changes you made to your defaults back into your resource file, preserving any comments or preprocessor lines.
-global Indicates that the operation should only be performed on the screen-independent RESOURCE_MANAGER property. This option is specific to X11R5.
-help Prints a brief description of the allowed flags.
-IDirectory ( uppercase i ) Passes through to the preprocessor and specifies a directory to search for files referenced with #include.
-load Indicates that the input is loaded as the new value of the specified properties, replacing the old contents. This is the default action.
-merge Indicates that the input merges with, instead of replaces, the current contents of the specified properties. This option performs a lexicographic sorted merge of the two inputs, which is probably not what you want, but remains for backward compatibility.
-n Indicates that changes to the specified properties (when used with -load or -merge) or to the resource file (when used with -edit) should be shown on the standard output, but should not be performed. This option is specific to X11R5.
-nocpp Indicates that the xrdb command should not run the input file through a preprocessor before loading it into properties.
-override Indicates that the input should be added to, instead of replacing, the current contents of the specified properties. New entries override previous entries.
-query Indicates that the current contents of the specified properties should print onto the standard output. Note that since preprocessor commands in the input resource file are part of the input file, not part of the property, they do not appear in the output from this flag.
-quiet Indicates that a warning about duplicate entries should not display. This option is specific to X11R5.
-remove Indicates that the specified properties should be removed from the server.
-retain Indicates that the server should be instructed not to reset if the xrdb command is the first client. This should never be necessary under normal conditions, since the xdm and xinit commands always act as the first client. This option is specific to X11R5.
-screen Indicates that the operation should only be performed on the SCREEN_RESOURCES property of the default screen of the display. This option is specific to X11R5.
-screens Indicates that the operation should be performed on the SCREEN_RESOURCES property of each screen of the display. For -load and -merge, the input file is processed once for each screen. This option is specific to X11R5.
-symbols Indicates that the symbols defined for the preprocessor should be printed onto the standard output.
-UName Passes through to the preprocessor and removes any definitions of this symbol.

Examples

  1. To load a file into the database:

    xrdb -load myfile
  2. To take the contents of the database just loaded and edit or put it into newfile:

    xrdb -edit newfile

Files

The xrdb command generalizes the ~/.Xdefaults files.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]