#!/bin/sh

# sleep for a little while to avoid duplicate startup
case "${XDG_SESSION_TYPE}" in
    x11)
        sleep 2
        ;;
    wayland)
        sleep 9
        ;;
esac

# Test whether fcitx is running correctly with dbus...
fcitx-remote > /dev/null 2>&1

if [ $? = "1" ]; then
    echo "Fcitx seems is not running"
    fcitx
else
    echo "Fcitx is running correctly."
fi
