Understanding resources

Methods for specifying resources

Overall, there are eight different ways to specify resources. These different approaches can be grouped in the following categories:

Application-specific resources
resource specifications, stored in files that are named for the applications they configure. These files are only read by the particular client, when it is first started.

Server-specific resources
resource specifications that apply to all clients, regardless of the host on which an application is running

Host-specific settings
resource specifications that relate only to the host on which an application is running, regardless of where the client is displayed

Command line options
resource specifications for the current invocation of a client
When a client is executed, the eight sources of resource definition are consulted in the following order. Resources that are defined later in this list have precedence over resources defined earlier.

  1. System-wide application-specific resource files:
    These files contain site-wide defaults for classes of applications. The files are named after the applications' class names and they are stored in the /usr/lib/X11/app-defaults directory. For example, the resource file for the scoterm client is called /usr/lib/X11/app-defaults/ScoTerm. When a client is executed, the resources in the client's resource file are loaded into the resource manager.

  2. User application-specific resource files:
    These files have the same name as those above, however they are stored in a different location, specified by the $XAPPLRESDIR environment variable. If this variable is not set, the files are located in a user's home directory. Use these files to override system-wide resource specifications for individual users.

  3. The X server's resource database:
    A number of resources are automatically loaded into the resource database and stored in the X server when the scosession session manager is first started. These resources are defined in files, named for an application's class, in the /usr/lib/X11/sco/startup directory. The resources defined in these files are placed in the resource database by the xrdb client. These resources are available to all applications, regardless of the host on which they execute.

    If scosession is not running, you can load resources into the resource database by running xrdb manually. These resources have the same level of priority as resources loaded when scosession is started.

  4. The $HOME/.Xdefaults file:
    This file is only used if resources are not loaded into the X server by xrdb. If you are running scosession, which runs xrdb, this file is never used. Resources specified in this file are only available on the local machine; you need to create one of these files for each machine on which you run clients.

  5. The file defined by $XENVIRONMENT:
    The contents of any file specified by the $XENVIRONMENT variable are loaded into the resource manager.

  6. The $HOME/.Xdefaults-hostname file:
    If the $XENVIRONMENT variable is not defined, the resource manager looks for a file named .Xdefaults-hostname in a user's home directory, where hostname is the name of the machine on which a client is running. The resources defined in this file effect any client that is run on the local machine, even if its output is sent to a remote display. You need to create one of these files for each machine on which you run clients.

  7. Application-specific options:
    Some applications have specific command-line options that only work for that client. For example, xclock's -chime option or xpr's -scale option.

  8. X Toolkit-standard options:
    Generally, all applications that use the X Toolkit, including the clients supplied with the system, accept a standard list of command-line options. In particular, the -xrm option can used to load any resource specification for the current Graphical Environment session from the command line.
The resource manager searches these locations for valid resource specifications, in the indicated order. All of the resource specifications are loaded and sorted. If a conflict in resource specifications is located, the conflict is resolved according to the precedence rules described earlier in this chapter. If the same resource is assigned conflicting values, the last definition encountered is used. For example, if the resource manager encounters the following resource specification early on:
   ScoTerm*scrollBar: false
and then locates the exact same specification, with a different value later, in a host-specific file:
   ScoTerm*scrollBar: true
the ``true'' value is used and scoterm is assigned a scroll bar.

After the resource manager determines which of the resource specifications should be implemented for a particular client, the client then merges these values with its own internal defaults, if any.

See also:

Next topic: Setting resources in the X server
Previous topic: Precedence rules for resource specifications

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003