Each widget in the hierarchy contains all of the properties of all of its ancestors. This means that for every widget, you can specify any resource in that widget, or in any of its ancestors.
| parameter | resource |
|---|---|
| -geometry | Size and position of the main window |
| -forground | forground color |
| -background | background color |
| -fn | font name |
| -title | program title |
| -iconImage | Image to use for the icon |
The syntax of the entry in the resource file is
ResourceSpecification: Value
Where the ResourceSpecification syntax is
{Application}[.|*]{WidgetName}[.|*]{WidgetName}...[.|*]Property
The WidgetName can be either a Class name, or an instance
name.
The resource specification specifies the path in the widget hierarchy for the applications. The specification starts with the name of the application, and is followed by a series of widget names or classes. The last part of a specification is the actual property of the widget.
Each part of the resource specification has a degree of binding. The degree of binding specifies how closely a resource specification must match the actual widget tree.
A period (.) is a tight binding. An asterisk (*) is a loose binding. A tight binding means that whatever widget is specified on the left must be the \fBdirect ancestor\fR of the widget on the right in order for thespecification to match.
A loose binding means that the widget specified on the left must be an ancestor, but not necessarily a direct ancestor.
If a widget name is specified, then the specification will match only if the corresponding widget in the widget tree has that name.
If a widget class is specified, then the specification will match if
the corresponding widget in the widget tree is of the correct type. The
instance
name doesn't matter.
A question mark can also be used to specify the existence of a widget,
but not to specify the name or class of the widget. In other words, '?'
means one widget, and '*' means zero or more widgets.
xrn.vpane.textinfo.foreground: black
xrn*background: light blue
Using loose binding can have some side effects. In this example,
the background of every widget in xrn is set to light blue. The forground
of \fIonly\fR the textinfo widget is set to black.
xrn.vpane.?.font: 6x10
This example specifies that all widgets that have one widget between
them and the vpane widget will have their font property set to 6x10.
xrn.vpane*font: 6x10
This example specifies that all widgets that are descendants of
the vpane widget will have their font property set to 6x10.
An exclamation (!) is used to designate a comment line.
The application defaults files are located in \fC/usr/lib/X11/app-defaults\fR.
These file can be thought of as a place to set system wide resource defaults.
These files are usually not modified very often.
{Application}[.|*]{WidgetName}[.|*]{WidgetName}...[.|*]Property
The WidgetName can be either a Class name, or an instance
name.
The resource specification specifies the path in the widget hierarchy for the applications. The specification starts with the name of the application, and is followed by a series of widget names or classes. The last part of a specification is the actual property of the widget.
Each part of the resource specification has a degree of binding. The degree of binding specifies how closely a resource specification must match the actual widget tree.
A period (.) is a tight binding. An asterisk (*) is a loose binding. A tight binding means that whatever widget is specified on the left must be the \fBdirect ancestor\fR of the widget on the right in order for the specification to match.
A loose binding means that the widget specified on the left must be an ancestor, but not necessarily a direct ancestor.
If a widget name is specified, then the specification will match only if the corresponding widget in the widget tree has that name.
If a widget class is specified, then the specification will match if the corresponding widget in the widget tree is of the correct type. The instance name doesn't matter.
If you typically use two different X server with different characteristics
(color vs. mono), \fIxrdb\fR will let you maintain a single .Xdefaults
file, but have different resources specified depending on which X server
you are using. \fIXrdb\fR uses \fIcpp\fR to process the .Xdefaults file
before it is loaded in the RESOURCE_MANAGER property. \fIXrdb\fR defines
several symbols that can be used in the .Xdefaults file. \fIxrbd -symbol\fR
will show the currently defined symbols for your environment.
.bp
Below are the symbols defined for an X Station.
-DHOST=tvstu.ColumbiaSC.NCR.COM
-DSERVERHOST=tvstu.ColumbiaSC.NCR.COM
-DCLIENTHOST=kzin
-DVERSION=11
-DREVISION=0
-DVENDOR="NCR Corporation"
-DRELEASE=2020037
-DWIDTH=1280
-DHEIGHT=1024
-DX_RESOLUTION=3938
-DY_RESOLUTION=3938
-DPLANES=1
-DBITS_PER_RGB=1
-DCLASS=StaticGray
Below are the symbols defined for the R5 X server.
-DHOST=grok3
-DSERVERHOST=grok3
-DCLIENTHOST=kzin
-DVERSION=11
-DREVISION=0
-DVENDOR="NCR Corporation"
-DRELEASE=5000
-DWIDTH=1152
-DHEIGHT=900
-DX_RESOLUTION=2954
-DY_RESOLUTION=2961
-DPLANES=8
-DBITS_PER_RGB=8
-DCLASS=PseudoColor
-DCOLOR
.bp
Bellow is an example .Xdefaults file that uses these symbols to change
the resources that will be specified.
!
Stuart's Xdefaults file
!
xclock*showTitle: off
xbiff*showTitle: off
xbiff*geometry:
-0+290
#if RELEASE == 5000 || RELEASE == 3
xbiff*geometry:
-0+290
#else
xpbiff*geometry:
-0+100
#endif
xterm*showTitle:
on
xclock*mode:
analog
xterm*paneSpread:
.25
#if RELEASE == 5000 || RELEASE == 3
xterm*font:
5x7
#else
xterm*font:
-*-fixed-bold-*13-*
#endif
xterm*scrollBar:
on
xterm*saveLines:
500
xterm*reverseVideo:
off
xterm*borderWidth:
1
#ifdef COLOR
xterm*cursorColor:
red
xterm*pointerColor:
red
#endif
xterm*loginShell:
true
#if RELEASE == 5000
oclock.geometry:
=100x100-0-0
oclock.customization:
-color
#else
#if RELEASE == 3
oclock.geometry:
=100x100-0-0
#else
oclock.geometry:
=100x100-0+0
#endif
#endif
Command line option
$XENVIRONMENT or $HOME/.Xdefaults-<hostname>
SCREEN_RESOURCE property
RESOURC_MANAGER property else $HOME/.Xdefaults
$HOME/<Classname>
app-default/<Classname>
Compiled in resources
First, run xcalendar, and use editres to get the widget
tree. Note that under the Tree menu, you can choose the Show
Class Names option to change the display
to show what type of widgets are used.
Select the top Label widget (called SUN if you are showing Widget names
instead of Class names) and under the Commands menu, choose Show
Resource Box. You should see this popup.
Select the label resource, and type in a new value for the label of this
widget. Your window should look like this.
Hit the Apply button, and the client will update the widget, and
look like this.
.