XResources

The ~/.Xdefaults file allows you to set global X application defaults all in one place. This is a benefit to you since it frees you from having to type a dozen and one command-line options each time you invoke the command.

The .Xdefaults file
My .Xdefaults file looks like this:
Mwm*keyboardFocusPolicy:        pointer
Mwm*frameBorderWidth:           3
Mwm*BoundaryWidth:              2
Mwm*showFeedback:               resize
Mwm*focusAutoRaise:             True
Mwm*autoRaiseDelay:             400


Mosaic*trackVisitedAnchors:     True
Mosaic*useGlobalHistory:        False
Mosaic*catchPriorAndNext:       True
Mosaic*homeDocument:            http://www.cen.uiuc.edu/
Mosaic*imageBorders:            False

! THIS is the quintessential XResource

Netscape*blinkingEnabled:       False

! I like to tile my xterms two-across, at least.  And I'm an old
! monochrome monitor junkie.  Sue me, I grew up on an Apple ][

XTerm*font:                     7x14
XTerm*scrollbar:                True
XTerm*background:               Black
XTerm*foreground:               Green

! Configuring xlock

XLock.mode:             	random
! Use iso compliant font.
XLock.font:   -adobe-new century schoolbook-medium-r-normal-*-*-300-*-*-*-*-*-*
XLock.background:       	SteelBlue
XLock.foreground:       	Black
XLock.username:         	And you are? 
XLock.password:         	And your problem is? 
XLock.info:             	Which part of "bite me" don't you understand?
XLock.validate:         	*clickety-click*
XLock.invalid:          	Thank you.  YOUR account has been deleted.

! xbuffy is a nifty version of xbiff that monitors multiple
! mailboxes & newsgroups, executes commands (like starting mail
! readers) by clicking, and bitchin' stuff like playing sounds when
! new mail is recieved.

XBuffy.boxfile:         	.xbuffyrc
XBuffy.geometry:       		-74-0
XBuffy.horizontal:      	True

! xdaliclock is a cool X-based clock.  I like it when I can get it.

xdaliclock.seconds:     	False
xdaliclock.geometry:    	70x64-0+0
xdaliclock.font:        	-adobe-helvetica-bold-*-*-*-16-*-*-*-*-*-*-*

! xload ignores all of all of the color information.  It sucks that way.

XLoad.highlight:        	Green
XLoad.foreground:       	Green
XLoad.background:       	Black
XLoad.geometry:        		70x70-0+64

Where to find XResources
The best place to find XResources is to look in the manpage of the application you want to configure. An excerpt from the 'xclock' manpage:
 X DEFAULTS
      This program uses the Athena Clock widget.  It understands all of the
      core resource names and classes as well as:

      width (class Width)
              Specifies the width of the clock.  The default for analog
              clocks is 164 pixels; the default for digital clocks is
              whatever is needed to hold the clock when displayed in the
              chosen font.

      height (class Height)
              Specifies the height of the clock.  The default for analog
              clocks is 164 pixels; the default for digital clocks is
              whatever is needed to hold the clock when displayed in the
              chosen font.

      update (class Interval)
              Specifies the frequency in seconds at which the time should be
              redisplayed.

      foreground (class Foreground)
              Specifies the color for the tic marks. The default depends on
              whether reverseVideo is specified.  If reverseVideo is
              specified the default is white, otherwise the default is
              black.


      hands (class Foreground)
              Specifies the color of the insides of the clock's hands. The
              default depends on whether reverseVideo is specified.  If
              reverseVideo is specified the default is white, otherwise the
              default is black.
Making it GO!
To make your .Xdefaults file take effect, put this code in your .xsession file, before you invoke the window manager:
if [ -f $HOME/.Xdefaults ]; then
  xrdb -merge $HOME/.Xdefaults
fi
The "-merge" argument to xrdb merges your defaults with the system defaults, so don't worry about losing other defaults you might have "forgotten" to set.


Mark D. Roth (roth@uiuc.edu)