if ! type -p fcitx > /dev/null 2>&1 ; then
echo "fcitx is not available."
return 1
fi
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_SWITCHER=imsw-multi
export QT_IM_MODULE=fcitx
case "$WINDOWMANAGER" in
*kde)
if ! type -p skim > /dev/null 2>&1 \
|| grep -i -q "^[[:space:]]*Autostart.*=.*false" $HOME/.kde/share/config/skimrc
then
fcitx -d
else
# skim will be used. But we don't start it here,
# we rely on the KDE autostart
# mechanism used in the skim package instead.
# skim -d
:
fi
;;
*)
fcitx -d
;;
esac