Xrdb is used to get or set 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 would 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 is used for 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 just placed in the RESOURCE_MANAGER property.)
The file specified by filename (or the contents from standard input if - or no filename is given) is optionally passed through the C preprocessor with the following symbols defined, based on the capabilities of the server being used:
- the hostname portion of the display to which you are connected.
- the SERVERHOST hostname string turned into a legal identifier. For example, "my-dpy.lcs.mit.edu" becomes SRVR_my_dpy_lcs_mit_edu.
- the same as SERVERHOST.
- the number of the display on the server host.
- the name of the host on which xrdb is running.
- the CLIENTHOST hostname string turned into a legal identifier. For example, "expo.lcs.mit.edu" becomes CLNT_expo_lcs_mit_edu.
- the vendor release number for the server. The interpretation of this number will vary depending on VENDOR.
- the X protocol minor version supported by this server (currently 0).
- the X protocol major version supported by this server (should always be 11).
- a string literal specifying the vendor of the server.
- the VENDOR name string turned into a legal identifier. For example, "MIT X Consortium" becomes VNDR_MIT_X_Consortium.
- A symbol is defined for each protocol extension supported by the server. Each extension string name is turned into a legal identifier. For example, "X3D-PEX" becomes EXT_X3D_PEX.
- the total number of screens.
- the number of the current screen (from zero).
- 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 usually is not related to PLANES.
- one of StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, DirectColor. This is the visual class of the root window.
- the visual class of the root window in a form you can #ifdef on. The value is the numeric id of the visual.
- defined only if CLASS is one of StaticColor, PseudoColor, TrueColor, or DirectColor.
- 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.)
- the height of the root window in pixels.
- the width of the root window in pixels.
- the number of bit planes (the depth) of the root window.
- the x resolution of the screen in pixels per meter.
- the y resolution of the screen in pixels per meter.
SRVR_name, CLNT_name, VNDR_name, and EXT_name identifiers are formed by changing all characters other than letters and digits into underscores (_).
Lines that begin with an exclamation mark (!) are ignored and may be used as comments.
Note that since xrdb can read from standard input, it can be used to the change the contents of properties directly from a terminal or from a shell script.
Xrdb does not load any files on its own, but many desktop environments use xrdb to load ~/.Xresources files on session startup to initialize the resource database, as a generalized replacement for ~/.Xdefaults files.
X(7), appres(1), listres(1), Xlib Resource Manager documentation, Xt resource documentation
The default for no arguments should be to query, not to overwrite, so that it is consistent with other programs.