2
# Copyright (C) 2005 Kenshi Muto <kmuto@debian.org>
3
# Modified for Debian package.
4
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
5
# copyrighted material is made available to anyone wishing to use, modify,
6
# copy, or redistribute it subject to the terms and conditions of the
7
# GNU General Public License version 2.
9
# You should have received a copy of the GNU General Public License
10
# along with this program; if not, write to the Free Software
11
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13
# X Input method setup script
15
# Keep original values related to IM
17
_XIM_PROGRAM=$XIM_PROGRAM
19
_XMODIFIERS=$XMODIFIERS
20
_GTK_IM_MODULE=$GTK_IM_MODULE
21
_QT_IM_MODULE=$QT_IM_MODULE
23
# $LNG is locale <language>_<region> without .<encoding> and .<encoding>@EURO
24
LNG=${LC_ALL:-${LC_CTYPE:-${LANG}}}
28
[ -z "$LNG" ] && LNG="all_ALL" || true
30
echo "Setting IM through im-switch for locale=$LNG."
32
# Source first found configuration under $LNG locale
33
for f in "$HOME/.xinput.d/${LNG}" \
34
"$HOME/.xinput.d/all_ALL" \
35
"/etc/X11/xinit/xinput.d/${LNG}" \
36
"/etc/X11/xinit/xinput.d/all_ALL" \
37
"/etc/X11/xinit/xinput.d/default" ; do
38
if [ -f "$f" -a -r "$f" ]; then
39
echo "Start IM through $f linked to $(readlink -f $f)."
47
# Revibe IM related environment if other values were set.
48
[ "$_XIM" ] && XIM=$_XIM || true
49
[ "$_XIM_PROGRAM" ] && XIM_PROGRAM=$_XIM_PROGRAM || true
50
[ "$_XIM_ARGS" ] && XIM_ARGS=$_XIM_ARGS || true
51
[ "$_XMODIFIERS" ] && XMODIFIERS=$_XMODIFIERS ||true
52
[ "$_GTK_IM_MODULE" ] && GTK_IM_MODULE=$_GTK_IM_MODULE || true
53
[ "$_QT_IM_MODULE" ] && QT_IM_MODULE=$_QT_IM_MODULE || true
56
[ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE || true
57
[ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE || true
60
[ -z "$XMODIFIERS" -a -n "$XIM" ] && XMODIFIERS="@im=$XIM" || true
61
[ -n "$XMODIFIERS" ] && export XMODIFIERS || true
64
if [ -n "$XIM_PROGRAM" -a -x "$XIM_PROGRAM" ]; then
65
if [ -z "$XIM_PROGRAM_SETS_ITSELF_AS_DAEMON" ]; then
66
eval "$XIM_PROGRAM $XIM_ARGS &" || true
68
eval "$XIM_PROGRAM $XIM_ARGS" || true
71
# execute XIM_PROGRAM_XTRA
72
[ -n "$XIM_PROGRAM_XTRA" ] && eval "$XIM_PROGRAM_XTRA &" || true