Setting X Window Resources on POSIX-based Systems
Nicole Cremel CN/ASD and Alessandro Miotto CN/DCI
We will restrict ourselves to X Window applications which are based on the X Toolkit Intrinsics (the more usual case), and not to applications using directly Xlib (like tk/tcl applications for instance), for which the ``resource setting'' mechanism does not obey to any fixed rules.
In X11R5 and for POSIX-based systems, the resource database is constructed when an application is launched by consulting the following sources of resource settings, in the order shown below. If a specification applies to a particular resource in more than one of these locations, then the first one in the list has priority (no override). The order of priority in resource setting is:
E.g. as -sb in xterm is bound to *scrollBar, a -sb or +sb in the command line would apply independently of any other setting.
N.B. All application written with the X Toolkit Intrinsics accept the options described in the X manual page. Additional options, but generally limited to a small subset of resources, may be added by the application programmer, on a per-application basis.
Resources contained in the ``screen-independent'' RESOURCE_MANAGER property can be set by the user using xrdb -load -global (and displayed with xrdb -query -global. Note that when there is only one screen SCREEN_RESOURCES is normally not used.
If the RESOURCE_MANAGER property does not exist (command xrdb -query -global gives nothing), then the contents of the file $HOME/.Xdefaults is used instead.
N.B. X11R5 introduced the file .Xresources whose contents are read by xrdb in the Xsession startup file. Nevertheless, it is up to the Xsession scripts to have explicitely a line like xrdb -load $HOME/.Xresources (which will be the case at CERN with the HEPiX scripts for a ``Common X Environment''). Also, as it is not mentionned whether .Xresources is loaded with the -global or -screen flag, it can make a difference whether the file .Xdefaults is used or not (if -global is used then .Xdefaults is ignored and .Xresources used instead).
if XAPPRESDIR is defined,
The application ``app-defaults'' file is searched calling XtResolvePathname() with the path specified by XFILESEARCHPATH, if defined, and type (%T), otherwise a system specific path (defined when building the X libraries) is used (typically /usr/lib/X11/app-defaults).
E.g. the files /usr/lib/X11/app-defaults/XLock or /usr/lib/X11/app-defaults/Mwm set up system-wide resources for the X application xlock and the .
For more precise information from a programmer's point of view type man XtResolvePathname (this manual page is available a least on HPs).
Notes: These notes are comments pointed out by various users. We put them here just for information.
We must add for completeness that the environment variable (XENVIRONMENT) may also be defined to override screen or global resources, using a file rather than the command line. But as its use is redundant when the user has full control over them (i.e. if xrdb sources the .Xresources file at session startup, as done in the HEPiX scripts) we will recommend, at CERN, not to use this variable.