File ibus-autostart of Package ibus
#!/bin/sh
#
# Normal start process for X11 session
# Note that INPUT_METHOD is not usually set under a Wayland session.
#
# For Plasma Wayland, see also /usr/etc/xdg/plasma-workspace/env/20-ibus-plasma-setup.sh.
# To configure input method (virtual keyboard), please use KDE System Settings rather than
# INPUT_METHOD variable.
test x"$INPUT_METHOD" = x"ibus" || exit 0
# GNOME starts ibus by itself
case "$XDG_CURRENT_DESKTOP" in
*GNOME*)
exit 0;;
esac
restart=0
if test -x /usr/bin/pgrep; then
if pgrep --quiet ibus-daemon; then
restart=1
fi
fi
command="ibus start"
if [ "$restart" = "1" ]; then
command="ibus restart"
fi
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
case "$XDG_CURRENT_DESKTOP" in
*KDE*)
# This will update kwinrc and set IBus for the active virtual keyboard
$command --type=kde-wayland
exit 0;;
*)
$command --type=wayland
exit 0;;
esac
else
# sleep for a little while to avoid duplicate startup
# sleep 2
# `ibus start` does not exit, so we use ibus-daemon
ibus-daemon --xim --daemonize
exit 0
fi