|
Home / Software Design & Engineering /XResources Syntax |
X Resources Syntax |
|
The general syntax for settings in an X Resource file is:
|
|
The '!' character introduces comments. In our XResources example some sample settings are "commented out". Remove the '!' characters to activate them. Resource names and values are case insensitive, but Client_Class and Sub_Class names are not. Other X Resource files may be included in-place with #include. For example, the line
The Client_Class usually corresponds to the name of an application. For example, the Client_Class for the xterm application is XTerm; the Client_Class for IDL is Idl. However, be careful not confuse an application name with its Client_Class. A number of applications can use the same Client_Class. Client_Class X resource files are normally found in a directory named app-defaults. For example, system-wide Client_Class X resource files on Solaris are found in /usr/openwin/lib/X11/app-defaults. (on Linux and other flavors of UNIX, /usr/lib/X11/app-defaults) and system-wide Client_Class X resource files for IDL are found in $IDL_DIR/resource/X11/lib/app-defaults. Resources are applied in order; later ones override earlier ones. Similarly, if the same resource setting appears more than once in the same file, the last one prevails. Hence, you can specify user-specific X resource settings for yourself in your $HOME/.Xdefaults file. (Or $HOME/.Xdefaults-hostname where "hostname" is the name of a machine where you have a login directory.) Note that X Resource settings in this file affect all X applications. Changes for one application here may have undesirable consequences on other applications, and changes to this file these will not take effect until your next login session. You can also override the system-wide settings for a particular Client_Class by making a file with the same name in your $HOME login directory. For example, settings in $HOME/XTerm will override /usr/openwin/lib/X11/app-defaults/XTerm and settings in $HOME/Idl will override $IDL_DIR/resource/X11/lib/app-defaults/Idl. Changes to settings in these files take effect the next time you run an application that uses that and only that particluar Client_Class. Classes are hierarchical and the sequence of classes in a resource setting follows a path down the hierarchy. An asterisk (*) in the path represents any sequence of classes in the hierarchy, including none. This is called "loose binding". A period in the hierarchy separates adjacent classes and must exactly follow the hierarchy. This is called "tight binding". In general it is easier to use loose binding because you do not have to know the exact hierarchy for each application. For example, the background color for all IDL widgets can be set with:
For the most part, casual users should only change settings that affect the "look and feel" attributes of application GUI components (called "widgets"), primarily colors, typographic fonts, and the geometry for default placement on the monitor. GUI Classes on UNIX systems usually have names beginning with "Xm" for X Windows Motif, which are also used by Sun Microsystems' OpenWindows (available also on Linux) and the Common Desktop Environment, aka CDE, used also by XConsortium members HP, IBM, and Sun. Useful (and safe) settings for other resources should be well documented in X resource file comments and examples provided by the application vendor. X resources have no effect over attributes that are hard-coded in IDL programs, e.g.:
See also:
|
|
|
See Also:
|