Óýű¾ÊµÏÖ scim/fcitx µÄ×Ô¶¯ÅäÖÃ
[code][0 No.506 bash_codes $ ] cat xinput_setup.sh
#! /bin/bash
# auto configuration for scim and fcitx
# [email]li-jiahuan@sohu.com[/email]
# set -n
if [[ $(id -u) != 0 ]];then
echo "root privilege needed"
exit
fi
dir=/opt/my_xinput
scim_conf=$dir/myscim
fcitx_conf=$dir/myfcitx
link=/etc/X11/Xsession.d/91xinput
mkdir -p $dir
cat <<- end > $scim_conf
export XIM=SCIM
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export XIM_PROGRAM=scim
export XIM_ARGS="-d"
scim &
end
cat <<- end > $fcitx_conf
export XIM=fcitx
export XMODIFIERS="@im"=fcitx
GTK_IM_MODULE="fcitx"
fcitx &
end
#if [[ ! -e $link ]];then
update-alternatives --install $link xinput $scim_conf 20
update-alternatives --install $link xinput $fcitx_conf 10
#else
# :
#fi
while :
do
cat <<- EOF
Now you have to xinput configuration
1) scim
2) fcitx
which do you prefer :
EOF
read choice
case $choice in
1)
update-alternatives --set xinput $scim_conf
break
;;
2)
update-alternatives --set xinput $fcitx_conf
break
;;
*)
echo "wrong choice,try again"
;;
esac
done
echo "Detecting you fcitx and fcitx programs ..."
fcitx_bin=$(which fcitx)
scim_bin=$(which scim)
if [[ ! -z $fcitx_bin ]];then
echo "fcitx found in $fcitx_bin"
else
echo "fcitx not found, you may need to install it"
fi
if [[ ! -z $scim_bin ]];then
echo "scim found in $scim_bin"
else
echo "scim not found, you may need to install it"
fi
if [[ -e /tmp/.X0-lock ]];then
echo -e "Done\n I find you are running X,\
you may need to restart it"
fi
[/code]
Ò³:
[1]