delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/03/11/09:33:38

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_YF
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: u.JgLvyswBBMp9ZJJfsX14qmYb3T2ivhMAr6OupnxLpNQEFZ9g--
Message-ID: <513DDD14.1080305@dronecode.org.uk>
Date: Mon, 11 Mar 2013 13:33:08 +0000
From: Jon TURNEY <jon DOT turney AT dronecode DOT org DOT uk>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
MIME-Version: 1.0
To: wynfield AT gmail DOT com, cygwin AT cygwin DOT com
Subject: Re: X11 capturing DISPLAY value
References: <20130311081754 DOT 2260 AT binki>
In-Reply-To: <20130311081754.2260@binki>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

On 10/03/2013 22:17, 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 DISPLAY v
> alue.
> 
> Is there a preferred standard way to get this value?

If you cannot explicitly specify a display number, I would say, use the
'-displayfd' X server option [1], for example:

xinit -- -displayfd 3 3>~/.display
export DISPLAY=:`cat ~/.display`

Unfortunately, while this works with xinit, it seems there are bugs not
noticed until now which prevents this from working correctly with startx
(startx ends up supplying both :display and -displayfd, which doesn't work
correctly, and the xauthority generated may reference the wrong display
number, leaving clients unable to connect)

[1] http://x.cygwin.com/docs/ug/using-terminal-server.html

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019