|
楼主 |
发表于 2002-6-25 12:29:43
|
显示全部楼层
The X11 file
#!/bin/bash
# read the user (~/.i18n) or system-wide (/etc/sysconfig/i18n) i18n settings
. /etc/profile.d/lang.sh
# The Gnome applets must not be launched each time if they are already
# managed by Gnome; here is the file path to the Gnome Applets config file;
# so we can do a grep to see if a given applet is already managed by Gnome
GNOME_APPLET_CONFIG="$HOME/.gnome/panel.d/default/Applet_Config"
if [ -z "$XIM_PROGRAM" -a -z "$XIM" ]; then
locale=C
if [ ! -z "$LC_ALL" ]; then
locale=$LC_ALL
elif [ ! -z "$LC_CTYPE" ]; then
locale=$LC_CTYPE
elif [ ! -z "$LANG" ]; then
locale=$LANG
fi
case $locale in
zh_TW*)
export LC_CTYPE=zh_TW.Big5
XIM=xcin
;;
zh_CN*)
XIM=kinput2c
;;
ja*)
XIM=kinput2
;;
ko*)
XIM=Ami
;;
*)
XIM=none
;;
esac
fi
if [ -z "$XIM_PROGRAM" ]; then
case "$XIM" in
kinput2c) XIM_PROGRAM=kinput2c ;;
xcin*) XIM_PROGRAM=xcin ;;
kinput2) XIM_PROGRAM=kinput2 ;;
Ami)
# now ami determine which mode it will take from $DESKTOP variable
# (not from this script's first argument given by Xsession script)
# i think this way seems better.
# -- Jaegeum --
case $DESKTOP in
# Gnome init program automatically restore previous session's
# ami_applet. If you put ami_applet here, you may experience a lot of
# repeated error windows that report "an applet died abruptly".
# so we first check if the ami_applet is referenced in Gnome config
# files
# I think removing ` and ` around grep command is more reasonable.
# -- Jaegeum --
Gnome|GNOME|gnome)
if [ -f "$GNOME_APPLET_CONFIG" ] && \
grep -q '\<ami_applet\>' "$GNOME_APPLET_CONFIG";
then
XIM_PROGRAM=/bin/true
else
XIM_PROGRAM=ami_applet
fi ;;
# Now new wmami supports KDE2 docking mode.
# XIM_PROG_ARGS variable is added to send xim's arguments if
# they are needed.
# -- Jaegeum --
KDE|Kde|kde)
XIM_PROGRAM=wmami
XIM_PROG_ARGS="-wait" ;;
WindowMaker|WINDOWMAKER|Windowmaker|windowmaker)
XIM_PROGRAM=wmami
XIM_PROG_ARGS="-wait" ;;
# Following three WM entries should be added
# because that wmami supports them is already well known fact.
# -- Jaegeum --
AfterStep|AFTERSTEP|Afterstep|afterstep)
XIM_PROGRAM=wmami
XIM_PROG_ARGS="-wait" ;;
Enlightenment|ENLIGHTENMENT|enlightenment)
XIM_PROGRAM=wmami
XIM_PROG_ARGS="-wait" ;;
BlackBox|BLACKBOX|Blackbox|blackbox)
XIM_PROGRAM=wmami
XIM_PROG_ARGS="-wait" ;;
*)
XIM_PROGRAM=ami ;;
esac ;;
*) XIM_PROGRAM=/bin/true ;;
esac
fi
[ -z "$XMODIFIERS" -a -n "$XIM" ] && export XMODIFIERS="@im=$XIM"
if which $XIM_PROGRAM >/dev/null 2>/dev/null
then
# Following is needed
# because some xims lose their reason when they are running before xmanagers.
# increase delay time if you need to.
# -- Jaegeum --
( sleep 5 && $XIM_PROGRAM $XIM_PROG_ARGS ) &
fi |
|