2009年12月29日 星期二

Ubuntu連Windows遠端桌面


 在Ubuntu使用遠端桌面連線,不外乎rdesktop 和 tsclient。
但是我這個NB user,有些需求,是tsclient沒辦法達到的。※ 解析度1270x720

  這個可以用rdesktop解決,所以我寫了一個shell,可是就變成只能用文字介面輸入IP,所以衍生出新的問題:※ 要有視窗介面,可以輸入IP
所以我用zenity。以下是程式碼,可以直接剪去用。

#!/bin/sh
#Program:
#  This script use RDP protocol to connect to windows desktop.
#  Tsclient don't support custom resolution of RDP.
#  I use rdesktop with parameters to realize custom resolution.
#History:
#  2009/12/30 dna2me First release
#  Use zenity to get IP Address
IP=`zenity --entry \
--title="mstsc" \
--text="Enter your IP:" \
--entry-text="11.22.33.44" `

#If IP is entered, call rdesktop
if [ $IP != "" ];
then
  #If unable to connect(-T parameter means the title)
  if ! rdesktop -u dna -g 1270x720 -T MyPC $IP
  #Show error and error IP
  then zenity --error \
                        --text="Can't connect host: $IP"
  fi
fi

沒有留言:

張貼留言