|
楼主 |
发表于 2004-10-24 11:26:17
|
显示全部楼层
以下文字存成xim.zhpack
#!/bin/bash
#
# $Id: xim,v 1.5 2004/01/08 10:54:41 mfabian Exp $
#
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany
#
# Mike Fabian <mfabian@suse.de>, 2000, 2001, 2002
# We start the XIM server here in ~/.xim to avoid having to do the same
# for each desktop environment separately. This script is usually sourced
# by ~/.xinitrc or ~/.xsession. The input method server will die with X.
# If you prefer to use a different XIM server, feel free to
# edit this file :-)
# Determine the LC_CTYPE locale category setting
tmplang=${LC_ALL-${LC_CTYPE-${LANG-en_US}}}
# make sure we have all the necessary directories in the path to find
# the input servers and the tools like "pidof" which are used below
# (Ami is usually in /opt/gnome/bin!):
OLD_PATH=$PATH
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/opt/gnome/bin:/usr/lib/im/locale/ja/atokserver
case $tmplang in
ja*) # Japanese
# ATOK-X?
if type -p atokx_client > /dev/null 2>&1 \
&& pidof /usr/lib/im/htt > /dev/null 2>&1 \
&& pidof atokmngdaemon > /dev/null 2>&1
then
export XMODIFIERS="@im=htt"
LANG=ja_JP LC_ALL=ja_JP atokx_client &
# WXG?
elif type -p kinput2 > /dev/null 2>&1 \
&& pidof wxgserver > /dev/null 2>&1
then
export XMODIFIERS="@im=kinput2"
kinput2 -xim -kinput -canna -cannaserver unix &
# Canna?
elif type -p kinput2 > /dev/null 2>&1 \
&& pidof cannaserver > /dev/null 2>&1
then
export XMODIFIERS="@im=kinput2"
kinput2 -xim -kinput -canna -cannaserver unix &
# Wnn6?
elif type -p kinput2 > /dev/null 2>&1 \
&& pidof jserver > /dev/null 2>&1 \
&& test -d /usr/local/OMRONWnn6
then
kinput2 -xim -kinput -wnn \
-wnnenvrc6 /usr/local/OMRONWnn6/wnn6linux/ja_JP/wnnenvrc &
# FreeWnn?
elif type -p kinput2 > /dev/null 2>&1 \
&& pidof jserver > /dev/null 2>&1
then
export XMODIFIERS="@im=kinput2"
kinput2 -xim -kinput -wnn &
fi
;;
ko*) # Korean
if type -p ami > /dev/null 2>&1 ; then
export XMODIFIERS="@im=Ami"
case $WINDOWMANAGER in
*kde|*windowmaker|*wmaker)
ami -wm -wait &
;;
*)
ami &
;;
esac
fi
;;
zh_HK*) # Traditional Chinese for Hongkong
if type -p xcin > /dev/null 2>&1 ; then
export XMODIFIERS="@im=xcin-zh_HK"
LANG=zh_HK LC_ALL=zh_HK xcin &
fi
;;
zh_TW*) # Traditional Chinese
if type -p gcin > /dev/null 2>&1 ; then
export XMODIFIERS="@im=gcin"
gcin &
elif type -p scim > /dev/null 2>&1 ; then
export XMODIFIERS="@im=SCIM"
scim -d
elif type -p xcin > /dev/null 2>&1 ; then
export XMODIFIERS="@im=xcin-zh_TW"
LANG=zh_TW LC_ALL=zh_TW xcin &
fi
;;
zh_CN*) # Simplified Chinese
if type -p fcitx > /dev/null 2>&1 ; then
export XMODIFIERS="@im=fcitx"
fcitx &
elif type -p chinput > /dev/null 2>&1 ; then
export XMODIFIERS="@im=Chinput"
case $tmplang in
zh_CN.UTF-8|zh_CN.utf-8)
chinput -gb &
;;
*)
chinput &
;;
esac
elif type -p scim > /dev/null 2>&1 ; then
export XMODIFIERS="@im=SCIM"
scim -d
elif type -p xcin > /dev/null 2>&1 ; then
export XMODIFIERS="@im=xcin-zh_CN"
LANG=zh_CN LC_ALL=zh_CN xcin &
fi
;;
*) # all other languages:
# probably an XIM server is not needed.
# Nevertheless it may be useful to set XMODIFIER="@im=local"
# because "@im=local" means "use compose and dead-keys" and
# some programs will use compose and dead-keys only if XMODIFIERS
# is set to either "@im=local" or "@im=none".
export XMODIFIERS="@im=local"
# You may want to start an XIM server, even if you don't start
# your X11-session in a language which usually needs an input server.
# For example, some people may start their X11 session in English, because
# they mostly use English, but nevertheless want to have a Japanese
# input server running, because they also write Japanese texts.
# If you always want to have the Japanese XIM server "kinput2" running,
# uncomment the following two lines:
# export XMODIFIERS="@im=kinput2"
# kinput2 -xim -kinput -canna &
;;
esac
# probably better to restore the old value of PATH...
PATH=$OLD_PATH |
|