~ubuntu-branches/ubuntu/precise/im-switch/precise-updates

« back to all changes in this revision

Viewing changes to 80im-switch

  • Committer: Bazaar Package Importer
  • Author(s): Osamu Aoki
  • Date: 2009-12-10 19:53:29 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091210195329-ikb9ooyl43w2rtqh
Tags: 1.19
* Swiched to rules.tiny.
* Added ${misc:Depends}.
* Updated im-switch(8) to address confusion over all_ALL.
  (My best effort answer to issues raised by #513242)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
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.
 
8
#
 
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.
 
12
#
 
13
# X Input method setup script
 
14
 
 
15
# Keep original values related to IM
 
16
_XIM=$XIM
 
17
_XIM_PROGRAM=$XIM_PROGRAM
 
18
_XIM_ARGS=$XIM_ARGS
 
19
_XMODIFIERS=$XMODIFIERS
 
20
_GTK_IM_MODULE=$GTK_IM_MODULE
 
21
_QT_IM_MODULE=$QT_IM_MODULE
 
22
 
 
23
# $LNG is locale <language>_<region> without .<encoding> and .<encoding>@EURO
 
24
LNG=${LC_ALL:-${LC_CTYPE:-${LANG}}}
 
25
LNG=${LNG%@*}
 
26
LNG=${LNG%.*}
 
27
 
 
28
[ -z "$LNG" ] && LNG="all_ALL" || true
 
29
 
 
30
echo "Setting IM through im-switch for locale=$LNG."
 
31
 
 
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)."
 
40
        . "$f"
 
41
        break
 
42
    fi
 
43
done
 
44
 
 
45
unset LNG
 
46
 
 
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
 
54
 
 
55
 
 
56
[ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE || true
 
57
[ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE || true
 
58
 
 
59
# setup XMODIFIERS
 
60
[ -z "$XMODIFIERS" -a -n "$XIM" ] && XMODIFIERS="@im=$XIM" || true
 
61
[ -n "$XMODIFIERS" ] && export XMODIFIERS || true
 
62
 
 
63
# execute XIM_PROGRAM
 
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
 
67
        else
 
68
                eval "$XIM_PROGRAM $XIM_ARGS" || true
 
69
        fi
 
70
fi
 
71
# execute XIM_PROGRAM_XTRA
 
72
[ -n "$XIM_PROGRAM_XTRA" ] && eval "$XIM_PROGRAM_XTRA &" || true
 
73