总而言之就是用脚本实现了一遍搜狗官网教程 中的内容,脚本仅仅在虚拟机环境的 ubuntu 22 中对 sogoupinyin_4.2.1.145_amd64.deb 测试过,不保证在其他地方还能不能正常运行。
脚本启动需要用sudo命令以管理员权限执行,脚本执行完毕并重启电脑后,按Ctrl+空格键调出输入法,按Shift键切换中英文。
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 #!/bin/bash function PutTips () { echo "$(tput rev) $1$(tput sgr0) " sleep 1s } softFind=$(find sogoupinyin*.deb) if [ -z "$softFind " ]; then echo "脚本执行失败!请从搜狗官网下载正确的安装包后,前往安装包所在的目录再去尝试执行本脚本。" echo "搜狗输入法官网: http://shurufa.sogou.com/" exit elif [ "$DESKTOP_SESSION " == "ubuntu" ]; then echo "脚本执行失败!您的操作系统可能不是ubuntu。若您确实需要安装搜狗拼音输入法,请您前往搜狗官网下载好正确的安装包后,通过其他方式安装输入法。" echo "搜狗输入法官网: http://shurufa.sogou.com/" exit fi PutTips 正在更新源 apt update PutTips 正在安装fcitx输入法框架 apt install fcitx -y PutTips 正在将fcitx设为开机启动 cp /usr/share/applications/fcitx.desktop /etc/xdg/autostart/PutTips 正在卸载系统ibus输入法框架 apt purge ibus -y PutTips 正在安装搜狗输入法 dpkg -i "$softFind " PutTips 正在安装输入法的依赖 apt install libqt5qml5 libqt5quick5 libqt5quickwidgets5 qml-module-qtquick2 -y apt install libgsettings-qt1 -y tput el if [ "$1 " -ne "-y" ]; then read -r -p "重启电脑后才能调出输入法,要现在重启吗?[Y/n]" result else result=y fi if [ "$result " == y ] || [ "$result " == Y ]; then reboot fi