File: env_setup.sh

package info (click to toggle)
fcitx 1%3A4.2.9.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,800 kB
  • sloc: ansic: 134,151; cpp: 7,280; sh: 2,778; python: 800; xml: 345; makefile: 42
file content (63 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (5)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

# don't do anything on non-CJK at this time.
if locale | grep LC_CTYPE | grep -qv "[zh\|ja\|ko]_"; then
    return
fi

detect_binary()
{
    which "$1" > /dev/null 2>&1
}

detect_binary fcitx || return

detect_gtk()
{
    version=${1}.0
    detect_binary gtk-query-immodules-${version}
}

detect_gtk_im_module()
{
    gtk-query-immodules-${version} | grep -q 'fcitx'
}

detect_qt()
{
    detect_binary qmake
}

detect_qt_im_module()
{
    QTPATH=`qmake -query QT_INSTALL_PLUGINS`
    ls $QTPATH/inputmethods/*fcitx* > /dev/null 2>&1
}

if [ -z "$XMODIFIERS" ]; then
    export XMODIFIERS="@im=fcitx"
fi

if [ -z "$GTK_IM_MODULE" ]; then
    if detect_gtk 2 || detect_gtk 3; then
        if detect_gtk_im_module 2 || detect_gtk_im_module 3; then
            GTK_IM_MODULE=fcitx
        else
            GTK_IM_MODULE=xim
        fi

        export GTK_IM_MODULE
    fi
fi

if [ -z "$QT_IM_MODULE" ]; then
    if detect_qt; then
        if detect_qt_im_module; then
            QT_IM_MODULE=fcitx
        else
            QT_IM_MODULE=xim
        fi

        export QT_IM_MODULE
    fi
fi