public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: bat File to Launch Remote X11 Application
Date: Mon, 22 Nov 2021 23:06:08 -0700	[thread overview]
Message-ID: <a97a9e8b-374c-86b4-2f73-ca6de8bc2671@SystematicSw.ab.ca> (raw)
In-Reply-To: <20211123090728.5af5b26a25220b55dec148bc@nifty.ne.jp>

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

      reply	other threads:[~2021-11-23  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b1d63a2e-6399-5171-f642-e964a3fcb1e3.ref@bellsouth.net>
2021-11-22 19:15 ` Dennis Putnam
2021-11-23  0:07   ` Takashi Yano
2021-11-23  6:06     ` Brian Inglis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a97a9e8b-374c-86b4-2f73-ca6de8bc2671@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).