File xim.d-gcin of Package gcin

OLD_PATH=$PATH
PATH=/usr/bin:/usr/X11R6/bin:/opt/kde3/bin:$PATH

if ! type -p gcin > /dev/null 2>&1 ; then
    echo "gcin is not available."
    PATH=$OLD_PATH
    return 1
fi

#when skim installed, Autostart must be "false".
#here we move $HOME/.kde/share/config/skimrc to skimrc.orig.gcin
case "$WINDOWMANAGER" in
    *kde)
        if type -p skim > /dev/null 2>&1 \
          && ! grep -i -q "^[[:space:]]*Autostart.*=.*false" $HOME/.kde/share/config/skimrc
        then
            if [ -f $HOME/.kde/share/config/skimrc.orig.gcin ] ; then
               mv -f $HOME/.kde/share/config/skimrc $HOME/.kde/share/config/skimrc.orig.gcin
               chmod 777 $HOME/.kde/share/config/skimrc.orig.gcin
            fi
        cat > $HOME/.kde/share/config/skimrc << __END
[General]
Autostart=false
__END
        chmod 777 $HOME/.kde/share/config/skimrc
        else
        # do nothing
    	:
        fi

    ;;
    *)
        # do nothing
    ;;
esac

# If libreoffice-gnome was installed, Force OOo to use gtk-immodule
# so can gcin use on_the_spot mod to insert characters
	if [ -f /usr/lib/libreoffice/program/gconfbe1.uno.so ] || [ -f /usr/lib64/libreoffice/program/gconfbe1.uno.so ] ; then
	export OOO_FORCE_DESKTOP=gnome
	fi

# Determine the LC_CTYPE locale category setting
tmplang=${LC_ALL-${LC_CTYPE-${LANG-en_US}}}

case $tmplang in
    zh_*) # Traditional Chinese and Simplify Chinese
            export LC_CTYPE=$LANG
            # So you can use either zh_TW.UTF-8 or zh_TW.Big5 or zh_CN.UTF-8 or zh_CN.GB2312
            export XMODIFIERS="@im=gcin" 
            export GTK_IM_MODULE=gcin
            export QT_IM_SWITCHER=imsw-multi
            export QT_IM_MODULE=gcin
            gcin &
    ;;
    *)      # for other languages try to export LC_TYPE=zh_TW.UTF-8(or you want to use LC_CTYPE=zh_CN.UTF-8), I'm not sure if this can work
            export LC_CTYPE=$LANG
            export XMODIFIERS="@im=gcin" 
            export GTK_IM_MODULE=gcin
            export QT_IM_SWITCHER=imsw-multi
            export QT_IM_MODULE=gcin
            gcin &
    ;;
esac
PATH=$OLD_PATH

# success:
return 0
openSUSE Build Service is sponsored by