ibus/xim.d-ibus-121

85 lines
2.5 KiB
Plaintext
Raw Normal View History

OLD_PATH=$PATH
PATH=/usr/bin:/usr/X11R6/bin:/opt/kde3/bin:$PATH
if ! type -p ibus-daemon > /dev/null 2>&1 ; then
echo "ibus is not available."
PATH=$OLD_PATH
return 1
fi
case "$WINDOWMANAGER" in
#when skim installed, Autostart must be "false".
#here we move $HOME/.kde/share/config/skimrc to skimrc.orig.ibus
*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.ibus ] ; then
mv -f $HOME/.kde/share/config/skimrc $HOME/.kde/share/config/skimrc.orig.ibus
chmod 777 $HOME/.kde/share/config/skimrc.orig.ibus
fi
cat > $HOME/.kde/share/config/skimrc << __END
[General]
Autostart=false
__END
chmod 777 $HOME/.kde/share/config/skimrc
else
# do nothing
:
fi
;;
# GNOME 3 Settings Daemon keyboard plugin manages all ibus settings itself,
# so don't do manual setup&startup of ibus otherwise it would conflict with
# G-S-D. see bnc#873016.
*gnome*)
SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
if [ "$SOURCES" == '@as []' ]; then
echo "initial GNOME startup, ibus default configuration applied"
ibus-daemon -d
timer=5
while [ "$SOURCES" == '@as []' ] && [ ${timer} -gt 0 ]; do
sleep 1
timer=$[${timer}-1]
SOURCES=$(gsettings get org.freedesktop.ibus.general preload-engines)
done
ibus exit
fi
# make sure G-S-D keyboard plugin is active
echo "ibus will be managed by GNOME."
gsettings set org.gnome.settings-daemon.plugins.keyboard active true
PATH=$OLD_PATH
return 0
;;
*)
# do nothing
;;
esac
# Force OOo to use gtk-immodule
# Better way to fix cursor following problem (on_the_spot bug) under libreoffice-kde4
export OOO_FORCE_DESKTOP=gnome
# Determine the LC_CTYPE locale category setting
#tmplang=${LC_ALL-${LC_CTYPE-${LANG-en_US}}}
export LC_CTYPE=$LANG
export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE=ibus
export QT_IM_SWITCHER=imsw-multi
if [ -e /usr/$SYS_LIB/qt4/plugins/inputmethods/libqtim-ibus.so ]; then
export QT_IM_MODULE=ibus
else
export QT_IM_MODULE=xim
fi
if [ -z $DBUS_SESSION_BUS_ADDRESS ]; then
eval `dbus-launch --sh-syntax --exit-with-session --close-stderr < /dev/null`
fi
ibus-daemon --xim -d
PATH=$OLD_PATH
# success:
return 0