Re: X11 capturing DISPLAY value

2013-03-11 Thread Jon TURNEY
On 10/03/2013 22:17, wynfi...@gmail.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 21 | grep DISPLAY\= /tmp/xwin.txt 
  startx 21 | 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



X11 capturing DISPLAY value

2013-03-10 Thread wynfield

I wanted to capture the X11 DISPLAY value that shows on the console when 
'startx ' in invoked and successful.  I've tried:

 startx 21 | grep DISPLAY\= /tmp/xwin.txt 
 startx 21 | 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?

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



Re: X11 capturing DISPLAY value

2013-03-10 Thread Eliot Moss

On 3/10/2013 6:17 PM, wynfi...@gmail.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 21 | grep DISPLAY\= /tmp/xwin.txt 
  startx 21 | 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?


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



Re: X11 capturing DISPLAY value

2013-03-10 Thread d.henman
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 m...@cs.umass.edu wrote:
 On 3/10/2013 6:17 PM, wynfi...@gmail.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 21 | grep DISPLAY\= /tmp/xwin.txt 
startx 21 | 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