/usr/share/im-config/im-config.common is in im-config 0.24-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | # Input Method configuration, im-config.common
# (C) Osamu Aoki <osamu@debian.org>, GPL-2+
# vim: set sts=4 expandtab:
#
#############################################################
# IM Configuration functions used by im-config
#############################################################
# active_im
# echo active IM configuration name set in the system/user configuration
active_im () {
if [ ! -r $IM_CONFIG_XINPUTRC ]; then
echo -n "missing"
elif check_md5sum $IM_CONFIG_XINPUTRC ; then
# when configuration is autogenerated by im-config
IM_CONFIG_ACTIVE_IM=$(sed -n -e 's/^run_im \([^ ]*\) *$/\1/p' < $IM_CONFIG_XINPUTRC)
if [ -z "$IM_CONFIG_ACTIVE_IM" ]; then
echo -n "bogus"
elif [ -r $IM_CONFIG_DATA/[012345678]?_$IM_CONFIG_ACTIVE_IM.conf ]; then
echo $IM_CONFIG_ACTIVE_IM
else
echo -n "bogus"
fi
else
# when configuration is chenged manually by the user
echo -n "custom"
fi
}
# dsc_short <config>
# echo IM configuration short description for IM configuration name
dsc_short () {
if [ -r $IM_CONFIG_DATA/??_$1.conf ] ; then
# use subshell here
{
# subshell
. $IM_CONFIG_DATA/??_$1.conf
if [ "x$IM_CONFIG_AUTOMATIC" = "x$1" ]; then
echo -n "$IM_CONFIG_SHORT @"
else
echo -n "$IM_CONFIG_SHORT"
fi
}
else
IM_CONFIG_CODE="dsc_short"
IM_CONFIG_NAME=$1
eval_gettext "E: Configuration for \$IM_CONFIG_NAME not found at \$IM_CONFIG_CODE." >&2
echo >&2
fi
}
# dsc_long <config>
# echo IM configuration long description for IM configuration name
dsc_long () {
if [ -r $IM_CONFIG_DATA/??_$1.conf ] ; then
# use subshell here
{
# subshell
. $IM_CONFIG_DATA/??_$1.conf
echo -n "$IM_CONFIG_LONG"
}
else
IM_CONFIG_CODE="dsc_long"
IM_CONFIG_NAME=$1
eval_gettext "E: Configuration for \$IM_CONFIG_NAME not found at \$IM_CONFIG_CODE." >&2
echo >&2
fi
}
#############################################################
# Package status function used by menu
#############################################################
# avail_menu <config>
# configuration availability for menu listing
# define package_menu for 00-89
avail_menu () {
if [ -r $IM_CONFIG_DATA/??_$1.conf ]; then
. $IM_CONFIG_DATA/??_$1.conf
package_menu
else
IM_CONFIG_CODE="avail_menu"
IM_CONFIG_NAME=$1
eval_gettext "E: Configuration for \$IM_CONFIG_NAME not found at \$IM_CONFIG_CODE." >&2
echo >&2
# return FALSE
return 1
fi
}
#############################################################
# User modification verification functions used by im-config
#############################################################
# check_md5sum <filename>
check_md5sum () {
if [ -r "$1" ] && \
[ "# im-config signiture: $(head -n -1 $1 | md5sum)" = "$(tail -n 1 $1)" ]; then
true
else
false
fi
}
# write_config <config name> <file name>
write_config () {
IM_CONFIG_NAME=$1
IM_CONFIG_XINPUTRC=$2
if [ "x$IM_CONFIG_NAME" = "xREMOVE" ]; then
rm -f $IM_CONFIG_XINPUTRC
elif [ -r $IM_CONFIG_XINPUTRC ] && ! check_md5sum $IM_CONFIG_XINPUTRC ; then
eval_gettext "E: Configuration in \$IM_CONFIG_XINPUTRC is manually managed. Doing nothing." >&2
echo >&2
exit 1
elif [ ! -r $IM_CONFIG_DATA/??_$IM_CONFIG_NAME.conf ]; then
eval_gettext "E: \$IM_CONFIG_NAME is bogus configuration for \$IM_CONFIG_XINPUTRC. Doing nothing." >&2
echo >&2
exit 1
else
echo "# im-config(8) generated on $(date -R)" > $IM_CONFIG_XINPUTRC
echo "run_im $IM_CONFIG_NAME" >> $IM_CONFIG_XINPUTRC
echo "# im-config signiture: $(md5sum < $IM_CONFIG_XINPUTRC)" >> $IM_CONFIG_XINPUTRC
fi
}
#############################################################
# GUI/console UI functions used by im-config
#############################################################
# msgbox (wrap and scroll)
msgbox () {
if [ $IM_CONFIG_DIALOG = "console" ]; then
# console
dialog --title "$IM_CONFIG_ID" --msgbox "$1" 15 76
else
if [ "$KDE_FULL_SESSION" = true ] && [ -x /usr/bin/kdialog ]; then
# KDE GUI
tmp_file=$(mktemp --tmpdir im-config-kdialog.XXXXXXXX)
echo -n "$1" > $tmp_file
kdialog --title "$IM_CONFIG_ID" --textbox $tmp_file 600 400
rm -f $tmp_file
else
# GTK GUI
echo -n "$1" | zenity --width=600 --height=400 --title "$IM_CONFIG_ID" --text-info
fi
fi
}
# yesno (text size is fixed and must be small)
yesno () {
if [ $IM_CONFIG_DIALOG = "console" ]; then
# console
dialog --title "$IM_CONFIG_ID" --yesno "$1" 20 76
else
if [ "$KDE_FULL_SESSION" = true ] && [ -x /usr/bin/kdialog ]; then
# KDE GUI
kdialog --title "$IM_CONFIG_ID" --yesno "$1"
else
# GTK GUI
zenity --title "$IM_CONFIG_ID" --width=600 --height=400 --question --text "$1"
fi
fi
}
# menulist_init (size fixed)
# $1 text
# $2 colum1(GUI)
# $3 colum2(GUI)
# $4 colum3(GUI)
menulist_init () {
if [ $IM_CONFIG_DIALOG = "console" ]; then
# console
printf "%s" "dialog --title \"$IM_CONFIG_ID\" --radiolist \"$1\" 23 76 18"
else
# GTK GUI
printf "%s" "zenity --title=\"$IM_CONFIG_ID\" --width=600 --height=400 --text=\"$1\" --list --radiolist --column \"$2\" --column \"$3\" --column \"$4\""
fi
}
# menulist_add (size fixed)
# $1 $y
# $2 \"$(dsc_short $y)\"
# $3 on
menulist_add () {
if [ $IM_CONFIG_DIALOG = "console" ]; then
# console
printf "%s" "$1 \"$2\" $3"
else
# GTK GUI
if [ "x$3" = "xon" ]; then
printf "%s" "TRUE $1 \"$2\""
else
printf "%s" "FALSE $1 \"$2\""
fi
fi
}
# menulist_eval
# $1 command-line
menulist_eval () {
if [ $IM_CONFIG_DIALOG = "console" ]; then
# console
eval "$1"
else
# GTK GUI
eval "$1" 1>&2
fi
}
|