A shell script for configuring Chinese input methods in kali Linux
时间: 2024-05-25 15:15:18 浏览: 107
#!/bin/bash
# Check if the user is root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Install dependencies
apt-get update && apt-get install -y ibus ibus-pinyin ibus-libpinyin ibus-sunpinyin fcitx fcitx-googlepinyin fcitx-table-wbpy fcitx-config-gtk
# Set input method to IBus
echo "export XMODIFIERS=@im=ibus" >> /etc/environment
echo "export GTK_IM_MODULE=ibus" >> /etc/environment
echo "export QT_IM_MODULE=ibus" >> /etc/environment
# Restart IBus
ibus restart
# Set default input method to Pinyin
echo "export XIM_PROGRAM=ibus" >> ~/.xprofile
echo "export XIM=ibus" >> ~/.xprofile
echo "export GTK_IM_MODULE=ibus" >> ~/.xprofile
echo "export QT_IM_MODULE=ibus" >> ~/.xprofile
echo "export DefaultIMModule=ibus" >> ~/.xprofile
echo "ibus-daemon -d" >> ~/.xprofile
# Set fcitx as an alternative input method
update-alternatives --install /usr/bin/xinput xinput /usr/bin/fcitx 50
# Configure fcitx
echo "export XMODIFIERS=@im=fcitx" >> ~/.xprofile
echo "export GTK_IM_MODULE=fcitx" >> ~/.xprofile
echo "export QT_IM_MODULE=fcitx" >> ~/.xprofile
# Restart the X server
service lightdm restart
echo "Chinese input methods have been configured. Please log out and log back in to see the changes."
阅读全文