This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 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]

Windows Batch File to start xterm on Cygwin/X 1.7.x


I like to have one icon in Windows that I can click on to open a new
xterm window:
   - if the X server is not running, the icon would start X and launch
a xterm window
   - if the X server is running, it will simply open a new xterm
window on the existing X server

This was how it used to work by default in a very old version of
Cygwin.  It had been broken once before (search silent-dup-error in
the mailing list archives), fixed, and now broken again when
startxwin.bat became startxwin.exe.  So I've put together this batch
file that makes things work again on the latest version of Cygwin
1.7.1

$ cat startCygwinX.bat
@ECHO OFF

SET DISPLAY=127.0.0.1:0.0
SET CYGWIN_ROOT=\cygwin
SET RUN=%CYGWIN_ROOT%\bin\run -p /usr/bin

tasklist | \WINDOWS\system32\find.exe "XWin.exe"
if errorlevel 1 (
%RUN% bash.exe -l -c startxwin.exe
) ELSE (
%RUN% xterm -sb -rightbar -bg black -fg white +tb -sl 1000 -e /usr/bin/bash -l
)

Point a Windows icon to this batch file above, and you have one icon
to do it all.

I hope this is helpful to someone out there!

Best regards,

-- 
tzd.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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