This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: X11 capturing DISPLAY value

On 10/03/2013 22:17, 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)


Volunteer Cygwin/X X Server maintainer

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]