summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-11-30 12:17:58 +0000
committerintrigeri <intrigeri@boum.org>2015-11-30 14:36:27 +0000
commit853eafdd990b8c87057640cee2e2308705f50e22 (patch)
treed03c389af61df999ebc2f2e82b2562e1594435d0 /config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
parentd5e819614bd7ae601daf6070acffe6bf079db15a (diff)
Move tails-configure-keyboard out of $PATH.
Refs: #10658
Diffstat (limited to 'config/chroot_local-includes/usr/local/lib/tails-configure-keyboard')
-rwxr-xr-xconfig/chroot_local-includes/usr/local/lib/tails-configure-keyboard61
1 files changed, 61 insertions, 0 deletions
diff --git a/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard b/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
new file mode 100755
index 0000000..c648133
--- /dev/null
+++ b/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -eu
+
+# Get $XKBMODEL, $XKBLAYOUT, $XKBVARIANT and $XKBOPTIONS
+. /var/lib/tails-user-session/keyboard
+
+if [ -z "$XKBVARIANT" ] ; then
+ XKBCONF="$XKBLAYOUT"
+else
+ XKBCONF="$XKBLAYOUT+$XKBVARIANT"
+fi
+
+# Choose the keyboard layout we'll use regardless of the IBus input methods
+if [ "$XKBLAYOUT" = 'us' ] ; then
+ SOURCES="('xkb', '$XKBCONF')"
+else
+ SOURCES="('xkb', '$XKBCONF'), ('xkb', 'us')"
+fi
+
+# Choose preferred IBus input methods
+LANGPREFIX=`echo "$LANG" | sed 's/_.*//'`
+case "$LANGPREFIX" in
+ ja)
+ PRELOAD="['anthy', 'pinyin', 'hangul', 'Unikey', 'bopomofo']"
+ SOURCES="[$SOURCES, ('ibus', 'anthy'), ('ibus', 'pinyin'), ('ibus', 'hangul'), ('ibus', 'Unikey'), ('ibus', 'bopomofo')]"
+ NEEDIBUS='y'
+ ;;
+ ko)
+ PRELOAD="['hangul', 'pinyin', 'anthy', 'Unikey', 'bopomofo']"
+ SOURCES="[$SOURCES, ('ibus', 'hangul'), ('ibus', 'pinyin'), ('ibus', 'anthy'), ('ibus', 'Unikey'), ('ibus', 'bopomofo')]"
+ NEEDIBUS='y'
+ ;;
+ vi)
+ PRELOAD="['Unikey', 'hangul', 'pinyin', 'anthy', 'bopomofo']"
+ SOURCES="[$SOURCES, ('ibus', 'Unikey'), ('ibus', 'hangul'), ('ibus', 'pinyin'), ('ibus', 'anthy'), ('ibus', 'bopomofo')]"
+ NEEDIBUS='y'
+ ;;
+ zh)
+ PRELOAD="['pinyin', 'bopomofo', 'anthy', 'hangul', 'Unikey']"
+ SOURCES="[$SOURCES, ('ibus', 'pinyin'), ('ibus', 'bopomofo'), ('ibus', 'anthy'), ('ibus', 'hangul'), ('ibus', 'Unikey')]"
+ NEEDIBUS='y'
+ ;;
+ *)
+ PRELOAD="['pinyin', 'anthy', 'hangul', 'Unikey', 'bopomofo']"
+ SOURCES="[$SOURCES, ('ibus', 'pinyin'), ('ibus', 'anthy'), ('ibus', 'hangul'), ('ibus', 'Unikey'), ('ibus', 'bopomofo')]"
+ NEEDIBUS='n'
+ ;;
+esac
+
+# Configure enabled input methods and their preferred order
+dconf write /desktop/ibus/general/preload-engines "$PRELOAD"
+dconf write /org/gnome/desktop/input-sources/sources "$SOURCES"
+if [ -n "$XKBOPTIONS" ] ; then
+ dconf write /org/gnome/desktop/input-sources/xkb-options "$XKBOPTIONS"
+fi
+
+# Export environment variables to enable use of IBus
+export GTK_IM_MODULE='ibus'
+export QT_IM_MODULE='ibus'
+export XMODIFIERS='@im=ibus'