Mail Archives: cygwin/2013/03/11/00:48:51
X-Recipient: | archive-cygwin AT delorie DOT com
|
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,KHOP_RCVD_UNTRUST,KHOP_THREADED,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_NO,SPF_NEUTRAL
|
X-Spam-Check-By: | sourceware.org
|
Message-ID: | <20130311134832.3448@binki>
|
From: | "d.henman" <dhenman AT gmail DOT com>
|
Date: | Mon, 11 Mar 2013 13:48:32 +1000
|
To: | <cygwin AT cygwin DOT com>
|
Subject: | Re: X11 capturing DISPLAY value
|
In-reply-to: | Your message of Sun, 10 Mar 2013 19:29:57 -0400 <513D1775.1090109@cs.umass.edu>
|
References: | <20130311081754 DOT 2260 AT binki> <513D1775 DOT 1090109 AT cs DOT umass DOT edu>
|
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm
|
List-Id: | <cygwin.cygwin.com>
|
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
|
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com>
|
List-Archive: | <http://sourceware.org/ml/cygwin/>
|
List-Post: | <mailto:cygwin AT cygwin DOT com>
|
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
|
Sender: | cygwin-owner AT cygwin DOT com
|
Mail-Followup-To: | cygwin AT cygwin DOT com
|
Delivered-To: | mailing list cygwin AT cygwin DOT com
|
Thanks, but I don't like hard coding something important like that. It might work most of the time, in my case it wouldn't work, my X-window comes up as ":1" and it appears sometimes as ":0", but mainly one, but if more people were on the machine it cou
ld be other values as well.
You're right about the background takes time, I'll attempt coordination the timing better and try it.
Thanks
Eliot Moss <moss AT cs DOT umass DOT edu> wrote:
> On 3/10/2013 6:17 PM, wynfield AT gmail DOT com wrote:
> > I wanted to capture the X11 DISPLAY value that shows on the console when 'startx &' in invoked and successful. I've tried:
> >
> > startx 2>&1 | grep DISPLAY\= >/tmp/xwin.txt &
> > startx 2>&1 | grep DISPLAY >/tmp/xwin.txt &
> >
> > but neither worked. I could check files in /tmp/.X11-unix/* for date, owner, etc, and hope that the newest one is the right one and extract the number from the name, however if another user started an X window in the meantime I'd get the wrong DISPL
AY v
> > alue.
> >
> > Is there a preferred standard way to get this value?
>
> Usually :0.0 or something like $(hostname):0.0 will do, unless you
> have multiple screens or are connecting to a remote host. In the
> latter case you would not be running startx, so the :0.0 or
> $(hostname):0.0, or something along those lines, should be fine.
> I believe it's the usual thing most people do ...
>
> As for the above, if you try immediately to examine /tmp/xwin.txt,
> the answer may not be there yet, since it takes a little while
> for startx and grep to begin to do their thing and you put & at
> the end of the pipeline, which means to proceed immediately.
> So there's an inherent shell script programming timing / concurrency
> race that you would need to solve for this approach to work.
>
> Regards -- Eliot Moss
>
> --
> Problem reports: http://cygwin.com/problems.html
> FAQ: http://cygwin.com/faq/
> Documentation: http://cygwin.com/docs.html
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -