#!/bin/sh

if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" = "x" ]; then
    echo "Unknown option: $1"
    echo "Usage: $0 SESSION-PROGRAM"
    exit 1
fi

START_SESSION="$@"

if [ -x /usr/bin/fcitx-remote ]; then
    /usr/bin/fcitx-remote > /dev/null || /usr/bin/fcitx
fi

exec $START_SESSION
