X Defaults for applications??

I have just read the man page for Xbiff (mail notifier).

There is a list of options that can be used ‘xbiff -bg red’ etc. But there is also
a section called ‘X defaults’ with options like ‘checkCommand, onceOnly’ etc. But how do I apply these options and make sure that they only apply for xbiff?

In in your home directory there is either a file called ‘.Xdefaults’ or ‘.Xresources’ (sometimes one is a link to the other). Add to this file a line like:XBiff*onceOnly: true

Except of course, as this is a resource, “XBiff” as you have it there should all be in lowercase letters.

– Thomas Adam

Could you elaborate on this for my benefit? Granted, I’ve learned my X
resources on the street, but I thought the capitalization as I have it is necessary so that the specification holds in all instances, eg XBiff*foreground: purple would work for xbiff -name one and xbiff -name two alike.

Pretty much. I’ll try and explain…

When you set a resource option in ~/.Xdefaults or ~/.Xresources (the former is somewhat antiquated now) what happen is that the application will query the resource database and set the various properties for that part of the window that it recognises. The format looks like this:

clientname(.|*): value

So you might have, for instance:

*font: fixed
xterm.title: xterm

Those options which begin with a full-stop (or an asterisk) as in the case for font, apply to all windows, unless overruled further down by a specific application.

It gets a little more complicated than this though – consider for a moment that some applications might have multiple preferences being set for various bits of a window (moxfm does this, for instance). In the specific case, one can use:

foo.bar: baz

But for generic settings for resource level items, one can use an asterisk, as in:

foo*bar: baz

The ordering of which is important, as I am sure you’ll appreciate. Individual items are called “components”. These typically begin with a lower-case letter, whilst the corresponding class name would begin with an upper-case letter. Class names when used in resource settings take precedence over the instance name, example:

*Xbiff.something: value

– Thomas Adam

Thanks for the hearty explanation. Your point in your emendation of my reply was simply to, say, “degeneralize” my specification, right?

I suppose. I can’t quite envisage a situation where one is going to be running multiple instances of xbiff. ;)

– Thomas Adam