2015-08-10 15:44:14 +02:00
|
|
|
if ! type ibus-daemon > /dev/null 2>&1 ; then
|
2011-09-14 11:21:19 +02:00
|
|
|
echo "ibus is not available."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2016-02-28 17:32:13 +01:00
|
|
|
# explicitly set below, as referred in xdg autostart
|
|
|
|
export INPUT_METHOD=ibus
|
|
|
|
|
2011-09-14 11:21:19 +02:00
|
|
|
case "$WINDOWMANAGER" in
|
2014-05-20 16:40:03 +02:00
|
|
|
# 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.
|
2014-08-22 18:42:57 +02:00
|
|
|
*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
|
2014-05-20 16:40:03 +02:00
|
|
|
# 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
|
|
|
|
return 0
|
|
|
|
;;
|
2011-09-14 11:21:19 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
|
2017-12-20 15:17:42 +01:00
|
|
|
export XMODIFIERS="@im=ibus"
|
2014-05-20 16:40:03 +02:00
|
|
|
export GTK_IM_MODULE=ibus
|
|
|
|
export QT_IM_SWITCHER=imsw-multi
|
2017-12-20 15:17:42 +01:00
|
|
|
# Qt5
|
|
|
|
export QT_IM_MODULE=ibus
|
|
|
|
# Qt4
|
2014-05-20 16:40:03 +02:00
|
|
|
if [ -e /usr/$SYS_LIB/qt4/plugins/inputmethods/libqtim-ibus.so ]; then
|
2017-12-20 15:17:42 +01:00
|
|
|
export QT4_IM_MODULE=ibus
|
2014-05-20 16:40:03 +02:00
|
|
|
else
|
2017-12-20 15:17:42 +01:00
|
|
|
export QT4_IM_MODULE=xim
|
2014-05-20 16:40:03 +02:00
|
|
|
fi
|
2011-09-14 11:21:19 +02:00
|
|
|
|
2016-02-28 17:32:13 +01:00
|
|
|
case "$WINDOWMANAGER" in
|
|
|
|
*kde*|*xfce*|*lxde*)
|
|
|
|
# started via xdg autostart
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# FIXME: a little bit of delay is required to avoid race
|
|
|
|
(sleep 2; ibus-daemon --xim -d) &
|
|
|
|
;;
|
|
|
|
esac
|
2011-09-14 11:21:19 +02:00
|
|
|
|
|
|
|
# success:
|
|
|
|
return 0
|