From owner-freebsd-questions Fri Aug 22 09:32:51 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id JAA17711 for questions-outgoing; Fri, 22 Aug 1997 09:32:51 -0700 (PDT) Received: from tyree.iii.co.uk (tyree.iii.co.uk [193.117.77.66]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA17695 for ; Fri, 22 Aug 1997 09:32:39 -0700 (PDT) Received: from carrig.strand.iii.co.uk (carrig.strand.iii.co.uk [192.168.7.25]) by tyree.iii.co.uk (8.8.4/8.8.4) with ESMTP id RAA29604; Fri, 22 Aug 1997 17:30:07 +0100 (BST) Received: (from nik@localhost) by carrig.strand.iii.co.uk (8.8.7/8.8.7) id RAA04821; Fri, 22 Aug 1997 17:35:21 +0100 (BST) Message-ID: <19970822173520.35265@strand.iii.co.uk> Date: Fri, 22 Aug 1997 17:35:21 +0100 From: nik@iii.co.uk To: Randall Hopper Cc: Stephane Raimbault , questions@FreeBSD.ORG Subject: Setting X resources [was Re: Window sizes in X] References: <33D8AFA7.167EB0E7@cybersurf.net> <19970727090504.46117@ct.picker.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76e In-Reply-To: <19970727090504.46117@ct.picker.com>; from Randall Hopper on Sun, Jul 27, 1997 at 09:05:04AM -0400 Organization: interactive investor Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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