# start IBus
# vim: set sts=4 expandtab:

# hands off to set up IM if listed in $DESKTOP_SETUP_IBUS
if find_match "$IM_CONFIG_CURRENT_DESKTOP" "$DESKTOP_SETUP_IBUS" ; then
    # ibus set up is owned by desktop --> do the same as "none"
    if [ "$IM_CONFIG_PHASE" = 1 ] && [ "$XDG_SESSION_TYPE" = 'x11' ]; then
        # exception for Xorg sessions; background described in these bugs:
        # * https://bugs.debian.org/1009996
        # * https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/682
        # Since this is probably a workaround, let's review the situation in
        # good time before freeze time for Debian 12.
        GTK_IM_MODULE=ibus
    fi
    return
fi

if [ "$IM_CONFIG_PHASE" = 2 ]; then
# start IBus daemon and IM panel
IBUS_ENABLE_SYNC_MODE=0 /usr/bin/ibus-daemon --daemonize --xim
fi

if [ "$IM_CONFIG_PHASE" = 1 ]; then
# set variables for the plain XIM
XMODIFIERS=@im=ibus

# Let's assume all required modules are installed
GTK_IM_MODULE=ibus
QT_IM_MODULE=ibus
CLUTTER_IM_MODULE=ibus

fi

