summaryrefslogtreecommitdiff
path: root/source/x/fcitx5/fcitx5-autostart
blob: 22d8c056d33ba669785b178a44abc8af4e0b7ee1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

START="no"

if [ "$XIM" = "fcitx" ]; then
  START="yes"
fi

if [ "$XIM_PROGRAM" = "fcitx" ]; then
  START="yes"
fi

if [ "$GTK_IM_MODULE" = "fcitx" ]; then
  START="yes"
fi

if [ "$QT_IM_MODULE" = "fcitx" ]; then
  START="yes"
fi

if [ "$START" = "no" ]; then
  exit 0
fi

# sleep for a little while to avoid duplicate startup
sleep 2

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

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