File: modify-XIM

package info (click to toggle)
gcin 2.9.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 22,776 kB
  • sloc: cpp: 33,947; ansic: 9,313; makefile: 653; sh: 557
file content (129 lines) | stat: -rw-r--r-- 2,789 bytes parent folder | download | duplicates (8)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash

QT_IM="xim"
if [ -f /usr/lib/qt3/plugins/inputmethods/libqgcin.so ]; then
  QT_IM="gcin"
fi

xinitdir=/etc/X11/xinit
ximorig=XIM.orig.gcin
if  [ -d $xinitdir ]; then
  cd $xinitdir
  if [ -f XIM ]; then
    [ -f $ximorig ] || mv XIM $ximorig

    sed -e "s/xcin/gcin/g" < $ximorig | sed -e "s/scim/gcin/g" > XIM
    chmod 755 XIM
  # RH9, contributed by xacid.bbs@wretch.twbbs.org
  elif [ -f xinitrc.d/xinput ]; then
    cd xinitrc.d
    if [ ! -f xinput.orig.gcin ]; then
      mv xinput xinput.orig.gcin
    fi
    sed -e "s/XIM_PROGRAM=xcin/XIM_PROGRAM=gcin/" < xinput.orig.gcin > \
      xinput
    chmod 755 xinput
  # others
  else
    echo "Please modify your XIM settings manually"
  fi
else
  echo "Directory $xinitdir does not exist"
fi

cd /etc/sysconfig

## below is for Mandrake 10.1
[ -f i18n.orig.gcin ] || mv i18n i18n.orig.gcin

sed -e "s/im=SCIM/im=gcin/" < i18n.orig.gcin |
sed -e "s/scim -d/gcin/" | \
sed -e "s/GTK_IM_MODULE=scim/GTK_IM_MODULE=gcin/" | \
sed -e "s/QT_IM_MODULE=.*/QT_IM_MODULE=$QT_IM/" > i18n


#add GTK_IM_MODULE=gcin if necessary
egrep '^GTK_IM_MODULE=gcin' i18n >& /dev/null
if [ $? != 0 ]; then
  echo "GTK_IM_MODULE=gcin" >> i18n
fi

egrep '^QT_IM_MODULE' i18n
if [ $? != 0 ]; then
  echo "QT_IM_MODULE=$QT_IM" >> i18n
fi

egrep '^XIM_PROGRAM=gcin' i18n >& /dev/null
if [ $? != 0 ]; then
  echo "XIM_PROGRAM=gcin" >> i18n
fi

#egrep '^XIM=gcin' i18n >& /dev/null
#if [ $? != 0 ]; then
#  echo "XIM=gcin" >> i18n
#fi

#egrep '^XMODIFIERS=@im=gcin' i18n >& /dev/null
#if [ $? != 0 ]; then
#  echo "XMODIFIERS=@im=gcin" >> i18n
#fi


cd /usr/bin
grep -i scim crxvt >& /dev/null
if [ $? = 0 ]; then
  [ -f crxvt.orig.cin ] || mv crxvt crxvt.orig.cin

  sed -e "s/XIM=SCIM/#XIM=xim/" < crxvt.orig.cin > crxvt
  chmod 755 crxvt
fi

# Mandrake 10.0 & 9.2 have this problem.
grep xcin-zh_TW crxvt >& /dev/null
if [ $? = 0 ]; then
  [ -f crxvt.orig.cin ] || mv crxvt crxvt.orig.cin

  sed -e "s/XIM=xcin-zh_TW/#XIM=xcin/" < crxvt.orig.cin > crxvt
  chmod 755 crxvt
fi


# below is for Fedora Core 3
cd /etc/alternatives
if [ -f xinput-zh_TW ]; then
  [ -f xinput-zh_TW.orig.gcin ] || mv xinput-zh_TW xinput-zh_TW.orig.gcin
  cat > xinput-zh_TW << __END
XIM=gcin
XIM_PROGRAM=gcin
XIM_ARGS=""
GTK_IM_MODULE=gcin
__END
fi

# install gtk IM module

# SUSE
PATH=$PATH:/opt/gnome/bin

for i in gtk-query-immodules-2.0 gtk-query-immodules-2.0-32 gtk-query-immodules-2.0-64
do
  which $i >& /dev/null
  if [ $? = 0 ]; then
    GTK_QUERY_IM=$i
    break
  fi
done

if [ $GTK_QUERY_IM ]; then
  GTK_ETC=/etc/gtk-2.0
  if [ ! -d $GTK_ETC ]; then
    GTK_ETC=/etc/opt/gnome/gtk-2.0
  fi
  cd $GTK_ETC

  imlib=gtk.immodules.lib
  [ -f gtk.immodules.lib64 ] &&  imlib=gtk.immodules.lib64

  $GTK_QUERY_IM > $imlib
  cp gtk.immodules.lib gtk.immodules
fi