Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 1997 17:35:21 +0100
From:      nik@iii.co.uk
To:        Randall Hopper <rhh@ct.picker.com>
Cc:        Stephane Raimbault <stephane@cybersurf.net>, questions@FreeBSD.ORG
Subject:   Setting X resources [was Re: Window sizes in X]
Message-ID:  <19970822173520.35265@strand.iii.co.uk>
In-Reply-To: <19970727090504.46117@ct.picker.com>; from Randall Hopper on Sun, Jul 27, 1997 at 09:05:04AM -0400
References:  <33D8AFA7.167EB0E7@cybersurf.net> <19970727090504.46117@ct.picker.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

This doesn't have a whole lot to do with FreeBSD, however, the original
question was asked here, so I'm including the lists so that anyone who
finds the original in the archives also finds this one.

First, the original question:

On Sun, Jul 27, 1997 at 09:05:04AM -0400, Randall Hopper wrote:
> Stephane Raimbault:
>  |Hello, just wondering if there is a way to make the size of windows when
>  |you start a program always come up to a value the user prefers? 

And now Randall's reply:

> For Netscape, couple of things.  
[use of command line options and .Xdefaults ommitted]

> 3) you can create a file called "Netscape" that has the above
> Netscape.geometry line in it and put it in your X resource file search
> path.  E.g.:
> 
>     mkdir ~/cfg/app-defaults
>     echo "Netscape.geometry:  800x600+0+0" > ~/cfg/app-defaults/Netscape
>     setenv XAPPLRESDIR ~/cfg/app-defaults
> 
> I prefer option #3 because it keeps my .Xdefaults from being a huge mess
> (segmenting them by application), reduces possibilities of resource
> conflicts, reduces application startup time, and avoids having to run
> anything to retest after changing resources.

I've been doing some digging on this, and I've turned up what I think is
a more useful variation.

As above, create a directory to hold your application defaults. I called
mine ~/.app-defaults.

Then, instead of using XAPPLRESDIR, use the XUSERFILESEARCHPATH variable.
For example,

    setenv XUSERFILESEARCHPATH ~/.app-defaults/%N%C

The primary benefit is that it gives you more control over which files are
used. The key is the "%N%C" string. This is expanded to refer to the Name
of the application and the value (if any) of it's "*customization"
resource.

Consider the humble xterm. If you wanted every single xterm you run
to come up with white text on a black background, you could accomplish
this by creating a file called "XTerm" in the .app-defaults directory,
and adding the following two lines to it:

    *VT100*foreground: white
    *VT100*background: black

So far, no difference from Randall's suggestion.

The flexibility from this approach lies in the fact that a simple command
line parameter allows you to choose which one of the files from .app-defaults
will be used.

Imagine that you've customised your xterms as above. But now you decide that
you want some of your xterms to be yellow text on a black background. And
you'll run your mail client in these xterms.

As before, create a file in .app-defaults. However, this time, call it
"XTermMail", and in it put the two lines

    *VT100*foreground: yellow
    *VT100*background: black

Now, start an xterm like so

    xterm -xrm "*customization: Mail"

and the xterm will read its configuration from XTermMail, instead of XTerm.
The %N%C on the end of $XUSERFILESEARCHPATH causes xterm to look in the
file specified by the concatenation of its "Name" (XTerm) and the value
of the customization resource (Mail).

To answer Stephane's original question, he(?) could create multiple 
resource files for Netscape;

    .app-defaults/NetscapeSmall      Contains settings that take effect with
                                     -xrm "*customization: Small"

    .app-defaults/NetscapeBig        Contains settings that take effect with
                                     -xrm "*customization: Big"

and so on.

Hope that's useful.

N
-- 
--+==[ Nik Clayton is Just Another Perl Hacker at Interactive Investor ]==+--
            "Bother", said Pooh, as he deleted the root filesystem   NC5-RIPE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970822173520.35265>