文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>用Cygwin的X server取代Hummingbird Exceed或X-m..

用Cygwin的X server取代Hummingbird Exceed或X-m..

时间:2006-10-16  来源:lgfang

配置cygwin/x以及自动设置DISPLAY (by Grant Zhou)

last-edit-by: lungangfang 02-01-2007 14:10>

From: http://hi.baidu.com/grantzhou/blog/item/2edc1208bb8e33d163d98646.html

以下文章转自Grant的blog,有修改。原文标题为《配置cygwin/x以及自动设置DISPLAY》。

我们平时使用Hummingbird Exceed/X-manager其实只用到了它们的X server。而上 述两个软件都不是免费软件。我们完全可以使用cygwin的X server来替代它们。使 用cygwin的x-server优点:中文自动支持、鼠标支持特别是用emacs浏览code时的滚 轮支持等等。下面是使用cygwin的X server的配置过程。

1 启动cygwin/x

有几种方法,参见: http://x.cygwin.com/docs/ug/using.html#using-starting

1.1 直接运行windows bat 脚本

Edit C:\cygwin\usr\X11R6\bin\startxwin.bat [假设Cygwin的安装路径在C:\cygwin)

1) Remove
%RUN% xterm -e /usr/bin/bash -l
2) Add
%RUN% xhost +
%RUN% xhost +
很奇怪,一定要加两遍才行;加一遍有时候就不生效。3) get rid of the -silent-dup-error (Optional) change the line below:
%RUN% XWin -multiwindow -clipboard -silent-dup-error
to
%RUN% XWin -multiwindow -clipboard

1.2 用Cygwin bash脚本启动startx

每次启动会弹出一个必须保留弹出的xterm,如果退出这个xterm,X-Server自动退出。 而且你必须运行xhost + 来允许远程服务器弹出窗口到你的机器上来。可以通过更 改startxwin.sh脚本来启动x-server而无其他窗口弹出,并自动设置xhost:

1) 脚本位置
/usr/X11R6/bin/startxwin.sh
2) 屏蔽掉这几行
# Startup an xterm, using bash as the shell.
xterm -e /usr/bin/bash -l &
3) 加上这几行来允许可以显示到你桌面上的服务器
# add XXX server
xhost + 135.123.123.123
xhost + 135.123.123.124
当然,加入 xhost + 则允许任何机器 连接到该 X server4) 每次启动cygwin后,直接运行startxwin.sh 即可任务栏会显示Cygwin/X server图标5) 使用完毕后,记得在图标上点右键退出X-server要不cygwin会等待它的关闭 而长时间退不出。

2 设置远程机器的 DISPLAY 参数

为了将远程机器(server)上运行的GUI程序显示到本地,你必须在远程机器上设置 DISPLAY, 我们在使用Exceed或者X-Manager时,startx会在启动Xterm时自动设置, 其实我们也可以在.bashrc中加入自动设置DISPLAY的脚本:

if [ -z "$DISPLAY" ]; then
export DISPLAY=$(who am i | gawk 'BEGIN{FS="[()]"}{print $2}')":0.0"
fi

另一种方法是采用SSH(来自公司内部新闻组的 Peter Fales):

Use "ssh" (either Cygwins's command line ssh, or another utility like PuTTY) to connect to the remote machine and enable "X forwarding." (This is a GUI option in PuTTY. For the command-line ssh, you put "ForwardX11=yes" in your $HOME/.ssh/config file, or use "ssh -X".) Not only is this more secure than using the PC's IP address, it automatically sets $DISPLAY for you.

3 Enjoy

经过如上设置,每次先启动Cygwin X Server 后,使用任意工具(如DOS的telnet命 令,putty,securCRT等)telnet到服务器上后,直接运行任何图形界面的 X-windows 程序即可,如 emacs,tkcvs等。

相关阅读 更多 +
排行榜 更多 +
我是汪汪小画家

我是汪汪小画家

休闲益智 下载
中厦全供

中厦全供

购物比价 下载
越砍越低价

越砍越低价

购物比价 下载