Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!THUMPER.BELLCORE.COM!nsb From: nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) Newsgroups: comp.soft-sys.andrew Subject: Re: my menubar preferences Message-ID: <0cNXs=m0M2YtE2QicD@thumper.bellcore.com> Date: 24 Jun 91 18:46:35 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 54 Excerpts from internet.info-andrew: 24-Jun-91 Re: my menubar preferences Michael McInerny@andrew. (514+0) > Actually, what one really needs is a way to ask about the display (the > one pointed to by $DISPLAY): > ?DisplayClass=Color:... > or > ?DisplaySize=1280x1024:... > or > ?DisplayResolution=75:... > Does this seem like a reasonable proposal? \begin{slipperyslope} This reminds me a lot of the discussions that led to the "?M=", etc. syntax in the first place. Eventually, I added in a "?E=" (for things dependent on environment variables) because the predefined things like machine type & name were just not enough. I'm not sure you want to enumerate all the desired possibilities, either. Instead, one possibility is a more general mechanism in which a command is executed and its exit status determines whether or not the preference should be read. For example: ?X=/u/nsb/bin/iscolor: some-preference would execute the /u/nsb/bin/iscolor program and have some-preference take effect only if it returns a non-zero value. You might also want to hardwire some of the more common ones, like the ones Mike mentions, but there will be a never-ending stream of them. However, this is (obviously) not very efficient. But why do we need any changes at all? You can do the "right thing" today, with no code changes, if you really want. Add the code to .xinitrc that checks whatever you want and sets an environment variable, e.g. if (big-hairy-test) then setenv ISCOLOR 1 else setenv ISCOLOR 0 endif and then have preferences of the form ?E=ISCOLOR=1: whatever I believe that this approach will work for you today, without going any further down the slippery slope of hard-wired preference options.... -- Nathaniel