public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bat File to Launch Remote X11 Application
       [not found] <b1d63a2e-6399-5171-f642-e964a3fcb1e3.ref@bellsouth.net>
@ 2021-11-22 19:15 ` Dennis Putnam
  2021-11-23  0:07   ` Takashi Yano
  0 siblings, 1 reply; 3+ messages in thread
From: Dennis Putnam @ 2021-11-22 19:15 UTC (permalink / raw)
  To: cygwin

I have a remote X application on a Linux system that I want to launch 
with a Windows bat file. My main problem is how to determine if Cygwin/X 
is running and if not launch it. Once verified I think all I need to do 
is use SSH -Y with the command that starts the X application. Can 
someone help? TIA.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bat File to Launch Remote X11 Application
  2021-11-22 19:15 ` bat File to Launch Remote X11 Application Dennis Putnam
@ 2021-11-23  0:07   ` Takashi Yano
  2021-11-23  6:06     ` Brian Inglis
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Yano @ 2021-11-23  0:07 UTC (permalink / raw)
  To: cygwin

On Mon, 22 Nov 2021 14:15:32 -0500
Dennis Putnam wrote:
> I have a remote X application on a Linux system that I want to launch 
> with a Windows bat file. My main problem is how to determine if Cygwin/X 
> is running and if not launch it. Once verified I think all I need to do 
> is use SSH -Y with the command that starts the X application. Can 
> someone help? TIA.

What about something like:

set DISPLAY=:0
for /f "usebackq delims=" %%A in (`tasklist ^|find /C "XWin"`) do if %%A==0 start C:\cygwin64\bin\XWin %DISPLAY% -multiwindow
c:\cygwin64\bin\ssh -Y 192.168.0.133 xterm

Note that the above bat fails to start XWin if it is already
started with DISPLAY other than :0.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bat File to Launch Remote X11 Application
  2021-11-23  0:07   ` Takashi Yano
@ 2021-11-23  6:06     ` Brian Inglis
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Inglis @ 2021-11-23  6:06 UTC (permalink / raw)
  To: cygwin

On 2021-11-22 17:07, Takashi Yano via Cygwin wrote:
> On Mon, 22 Nov 2021 14:15:32 -0500
> Dennis Putnam wrote:
>> I have a remote X application on a Linux system that I want to launch
>> with a Windows bat file. My main problem is how to determine if Cygwin/X
>> is running and if not launch it. Once verified I think all I need to do
>> is use SSH -Y with the command that starts the X application. Can
>> someone help? TIA.
> 
> What about something like:
> 
> set DISPLAY=:0
> for /f "usebackq delims=" %%A in (`tasklist ^|find /C "XWin"`) do if %%A==0 start C:\cygwin64\bin\XWin %DISPLAY% -multiwindow
> c:\cygwin64\bin\ssh -Y 192.168.0.133 xterm
> 
> Note that the above bat fails to start XWin if it is already
> started with DISPLAY other than :0.

Assuming Cygwin bin is in your PATH, check for xinit base process using 
one of the following commands:

$ tasklist /fi "imagename eq xinit.exe"		\
Image Name                   PID Session Name      Session#    Mem Usage
======================== ======= =============== ========== ============
xinit.exe                   2652 Console                  1      2,952 K
$ ps -aeW					\
    37738  37632  37632      2652 cons0    197609   Oct 21 /usr/bin/xinit
$ procps -C xinit				\
   PID TTY          TIME CMD
37738 cons0    00:00:00 xinit

for first two commands, add check for xinit running:

| fgrep -w xinit \

and in all cases, if not, add X start, and sleep 60 or so, to give the X 
server adequate time, before starting the remote client:

|| (run --quote /usr/bin/bash -l -c "cd; exec /usr/bin/startxwin"; sleep 
60;)

$ ssh -Y $REMOTE $CLIENT

If you want to find the display, try looking under /tmp/:

$ ll -go /tmp/.X*
-r--r--r--  1 11 Oct 21 09:56 /tmp/.X0-lock

/tmp/.X11-unix:
total 1.0K
srw-rw-rw- 1 0 Oct 21 09:56 X0=
-rw------- 1 0 Aug 18 10:31 X0.lock

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-23  6:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <b1d63a2e-6399-5171-f642-e964a3fcb1e3.ref@bellsouth.net>
2021-11-22 19:15 ` bat File to Launch Remote X11 Application Dennis Putnam
2021-11-23  0:07   ` Takashi Yano
2021-11-23  6:06     ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).