2020年3月20日 星期五

執行遠端的 X 應用程式包含中文輸入法

本機: pc 端 linux 遠端 eeepc 901: 透過 ssh 連到「遠端 eeepc 901」

本機的 /etc/ssh/ssh_config 修改 ForwardX11 yes

這樣從本機連入 eeepc 901 時, eeepc 901 的終端機會設定 DISPLAY=localhost:10.0 就可以將遠端 eeepc 901 的 firefox 畫面執行到本機中。不用自己辛苦的設定 DISPLAY 變數。

遠端 xwindow app 使用中文輸入法

env: 連入 eeepc 901, 使用 eeepc 901 firefox, eeepc 901 裝的是 gcin, 本機裝的是 fcitx, 所以執行 eeepc 901 的 firefox 之後, 使用的是 gcin 來輸入中文, 本機的 x 應用程式則是用 fcitx, 有點複雜, 希望你沒昏頭。
ssh username_abc@eeepc901_ip # 請輸入對應的 username/ip
export XMODIFIERS=@im=gcin
export GTK_IM_MODULE=gcin
export QT_IM_MODULE=gcin # for telegram
gcin&
firefox
這樣就會看到 eeepc 901 的 firefox 在本機的 X 執行起來, 中文也可以正常輸入。

中文輸入的問題: 試了好多天, 終於搞定我的 X Client

如果遇到以下問題:
Error: cannot open display: localhost:10.0
X11 connection rejected because of wrong authentication.
參考:
xauth not creating .Xauthority file

使用 xauth 重新建立 ~/.Xauthority
# Rename the existing .Xauthority file by running the following command
mv .Xauthority old.Xauthority

# xauth with complain unless ~/.Xauthority exists
touch ~/.Xauthority

# only this one key is needed for X11 over SSH
xauth generate :0 . trusted

# generate our own key, xauth requires 128 bit hex encoding
xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom)

# To view a listing of the .Xauthority file, enter the following
xauth list

沒有留言:

張貼留言

使用 google 的 reCAPTCHA 驗證碼, 總算可以輕鬆留言了。

我實在受不了 spam 了, 又不想讓大家的眼睛花掉, 只好放棄匿名留言。這是沒辦法中的辦法了。留言的朋友需要有 google 帳號。