proxy代理   soft软件   IT 业界特快   norton 诺顿病毒库   代理列表   search FTP搜索   whois IP地理位置   blog 追求完美  
money理财   life生活   RSS聚合门户   firefox WEB浏览器   免费域名   typeset 假古文   AntiVirus 反病毒   ipcn 站点导航  

« === QTerm-0.3.8 Released === | Main | krusader - Linux 下的 Total Commander »

August 26, 2004

SCIM - Smart Common Input Method (智能通用输入法平台)

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2004/08/26/000488.html

SCIM 是 *nix 平台下最为出色的中文输入法
suzhe 的作品  http://scim.freedesktop.org/

最重要的是 SCIM 以模块化的思想 提供了一个通用的输入法开发平台
这个平台框架简化了输入法的开发

详细信息可以去 SCIM 的主页查看 http://scim.freedesktop.org/

Redhat 发行版默认是 Chinput
强烈推荐 scim 下面给出一个替换改动 patch


----->   /etc/X11/xinit/xinitrc.d/xinput.patch

--- xinput.orig 2003-02-06 04:18:31.000000000 +0800
+++ xinput      2004-08-25 11:32:18.000000000 +0800
@@ -102,7 +102,9 @@
            fi
         ;;
         zh_CN*)
-            if [ -e /usr/bin/chinput ]; then
+            if [ -e /usr/bin/scim ]; then
+               XIM="SCIM"
+            elif [ -e /usr/bin/chinput ]; then
                 XIM="Chinput"
            elif [ -e /usr/X11R6/bin/xcin ]; then
                export LC_CTYPE=zh_CN.GB2312
@@ -159,6 +161,10 @@
        ;;
       Chinput)
         XIM_PROGRAM=chinput ;;
+      SCIM)
+       XIM_PROGRAM=scim
+       XIM_ARGS="-d"
+       ;;
       xcin)
         XIM_PROGRAM=xcin ;;
       xcin-zh_CN.GB2312)



----->    /etc/X11/xinit/xinitrc.d/xinput

#!/bin/sh
# Copyright (C) 1999-2001 Red Hat, Inc.
#
# XIM( X Input Method ) script
#
# Korean part,etc contributed by
#       Won-kyu Park <wkpark@chem.skku.ac.kr>
#

oldterm=$TERM
unset TERM
# Load up the user and system locale settings
if [ -f /etc/profile.d/lang.sh ] ; then
  . /etc/profile.d/lang.sh
fi
export TERM=$oldterm

tmplang="en_US"
#if test x$GDM_LANG != x ; then
#    tmplang=$GDM_LANG
if test x$LC_ALL != x ; then
    tmplang=$LC_ALL
elif test x$LC_CTYPE != x ; then
    tmplang=$LC_CTYPE
elif test x$LANG != x ; then
    tmplang=$LANG
elif [ -e /etc/sysconfig/i18n ]; then
    . /etc/sysconfig/i18n
    tmplang=$LANG
fi

#
# check to see if the user has a preferred desktop
#

PREFERRED=

# runlevel 5 - checks which session manager it will load
# runlevel 3 - checks which desktop manager it will load
if [ -f /etc/sysconfig/desktop ]; then
# FIXME: This grep regex can be combined when someone has copious spare time.
 if grep -q "GNOME" /etc/sysconfig/desktop 2>/dev/null || grep -q "\"\"" /etc/sysconfig/desktop 2>/dev/null; then
         # runlevel 5 with gdm - checks for $GDMSESSION and set the $PREFERRED
         if [ x$GDMSESSION = xDefault ]; then
                 PREFERRED=gnome
         elif [ x$GDMSESSION = xGNOME ]; then
                 PREFERRED=gnome
         elif [ x$GDMSESSION = xKDE ]; then
                 PREFERRED=kde
         else
                 # applies if no env and runlevel 3
                 PREFERRED=gnome
         fi
 elif grep -q "KDE" /etc/sysconfig/desktop 2>/dev/null; then

        if [ -z $1 ] || [ x$1 = xdefault ]; then
                 # applies if no arg passed by kdm and runlevel 3
                 PREFERRED=kde
        else
                 # otherwise assign $PREFERRED from arg
                 PREFERRED=$1
        fi
 fi
fi

if [ -z $PREFERRED ]; then

        GSESSION=gnome-session
        STARTKDE=startkde

        # by default, we run GNOME.
        if which $GSESSION > /dev/null 2>&1; then
                PREFERRED=gnome
        fi

        # if GNOME isn't installed, try KDE.
        if which $STARTKDE > /dev/null 2>&1; then
                PREFERRED=kde
        fi
fi


#
# check $XIM and set a default $XIM value.
#
if [ -z "$XIM" ]; then
    case $tmplang in
        ko*)
            if [ -e /usr/bin/ami ]; then
                    XIM="Ami"
            elif [ -e /usr/bin/hanIM ]; then
                    XIM="hanIM"
            fi
        ;;
        ja*)
            if [ -e /usr/X11R6/bin/xwnmo ]; then
                    XIM="_XWNMO"
            elif [ -e /usr/X11R6/bin/kinput2 ]; then
                    XIM="kinput2"
            elif [ -e /usr/X11R6/bin/skkinput ]; then
                    XIM="skkinput"
            fi
        ;;
        zh_CN*)
            if [ -e /usr/bin/scim ]; then
                XIM="SCIM"
            elif [ -e /usr/bin/chinput ]; then
                XIM="Chinput"
            elif [ -e /usr/X11R6/bin/xcin ]; then
                export LC_CTYPE=zh_CN.GB2312
                XIM="xcin-zh_CN.GB2312"
            fi
        ;;
        zh_TW*)
            if [ -e /usr/X11R6/bin/xcin ]; then
                export LC_CTYPE=zh_TW.Big5
                XIM="xcin"
            fi
        ;;
        *)
            XIM="none"
        ;;
    esac
fi

#
# set a proper XIM program with respect to $XIM
#
if [ -z "$XIM_PROGRAM" ]; then
   case "$XIM" in
      Ami)
        case "$PREFERRED" in
           gnome)
                if which ami_applet >/dev/null 2>&1 ; then
                        DELAY_START=2
                        XIM_PROGRAM=ami_applet
                        XIM_ARGS=""
                elif which ami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=ami
                fi
          ;;
          kde)
                if which wmami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=wmami
                        XIM_ARGS="-wait"
                elif which ami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=ami
                fi
          ;;
          *)
                if which ami >/dev/null 2>&1 ; then
                        XIM_PROGRAM=ami
                fi
          ;;
        esac
        ;;
      hanIM)
        if which hanIM >/dev/null 2>&1 ; then
                XIM_PROGRAM=hanIM
        fi
        ;;
      Chinput)
        XIM_PROGRAM=chinput ;;
      SCIM)
        XIM_PROGRAM=scim
        XIM_ARGS="-d"
        ;;
      xcin)
        XIM_PROGRAM=xcin ;;
      xcin-zh_CN.GB2312)
        XIM_PROGRAM=xcin
        XIM_ARGS="-x xcin-zh_CN.GB2312" ;;
      _XWNMO)
        XIM_PROGRAM=xwnmo
         ;;
      kinput2)
        XIM_PROGRAM=kinput2
        if [ X"`ldd /usr/X11R6/bin/kinput2 | grep libcanna`" = X ] ; then
                XIM_ARGS="-wnnenvrc /etc/FreeWnn/ja/wnnenvrc"
        else
                XIM_ARGS="-canna"
        fi
         ;;
      skkinput)
        XIM_PROGRAM=skkinput
        XIM_ARGS="" ;;
      *)
        XIM_PROGRAM=/bin/true ;;
   esac
fi
[ -z "$XMODIFIERS" -a -n "$XIM" ] && export XMODIFIERS="@im=$XIM"

# execute XIM_PROGRAM


if test x$DELAY_START != x; then
        #spawn to new process with external shell
  bash -c "
    while [ x\`ps -C panel -o pid=\` == x ]; do
        sleep $DELAY_START
    done
    [ -z "\$XMODIFIERS" -a -n "$XIM" ] && export XMODIFIERS="@im=$XIM"
    sleep $DELAY_START
    which $XIM_PROGRAM > /dev/null 2>&1 && LANG=$tmplang $XIM_PROGRAM $XIM_ARGS &
  " &

else
        which $XIM_PROGRAM > /dev/null 2>&1 && LANG=$tmplang $XIM_PROGRAM $XIM_ARGS &
fi 

本blog WWW

Posted by windtear at August 26, 2004 5:45 PM

本站使用中的任何问题,请与 windtear @ windtear.net 联系
Copyright© 1999-2024 Windtear. All rights reserved.