寧波網(wǎng)站建設(shè)明細報價1小時快速搭建網(wǎng)站
Ubuntu22.04安裝中文輸入法?由踩坑到上岸版?
- 了解
- 入坑
- 上岸
- 更新一發(fā):Gedit中文亂碼問題的解決
為了方便回憶和記錄甚至后面繼續(xù)重裝系統(tǒng),我還是寫一下以便將來用到或參考~
了解
安裝Ubuntu22.04(截至2023年08月26日11:02:58是最新版本),具體安裝過程可參考我的博客或TA的博客
因為ubuntu系統(tǒng)沒有中文輸入,所以需要安裝中文輸入法,以下兩款供我們選取:
ibus(系統(tǒng)自帶);
fcitx。
入坑
經(jīng)過ibus VS fcitx對比后,使用總結(jié)后,果斷選擇fcitx。
喜歡ibus的人可以參考Github這篇文章:
https://github.com/ibus/ibus
IBus - Input BusIntroduction
===IBus is an Intelligent Input Bus. It is a new input framework for Linux OS.
It provides full featured and user friendly input method user interface.
It also may help developers to develop input method easily.How to build & test IBus
===ibus-setup:
It is a gtk program to enable and configure ibus.ibus:
It is ibus daemon.hotkeys:
Super + Space: Change input method.For more detail please refer to https://github.com/ibus/ibus/wiki/ReadMe .Peng Huang <shawn.p.huang@gmail.com>
開始安裝fcitx(準確來說應(yīng)該是Fcitx5):
Ubuntu 設(shè)置中打開「區(qū)域與語言」—>「管理已安裝的語言」,然后自動檢查已安裝語言是否完整。若不完整,根據(jù)提示安裝:
按照:1. Fcitx 5 主程序; 2.中文輸入法引擎; 3.圖形界面相關(guān)思路,可以直接使用 apt 進行安裝:
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk3 fcitx5-frontend-gtk2 fcitx5-frontend-qt5 kde-config-fcitx5
然后說是安裝維基百科中文拼音詞庫,下載最新的.dict 文件:
使用命令:
# 下載詞庫文件
wget https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.4/zhwiki-20230823.dict
# 創(chuàng)建存儲目錄
mkdir ~/.local/share/fcitx5/pinyin/dictionaries/
# 移動詞庫文件至該目錄
mv zhwiki-20230823.dict ~/.local/share/fcitx5/pinyin/dictionaries/
設(shè)置默認輸入法:
不得不說還是挺有用的…
利用命令sudo vim /etc/profile
設(shè)置環(huán)境變量:
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
可以安裝tweaks:sudo apt install gnome-tweaks
設(shè)置開機自啟動,
最后說的是配置:
- 在應(yīng)用程序列表中打開「Fcitx 配置」
- 在 Fcitx 托盤上右鍵打開「設(shè)置」
- 命令行命令 fcitx5-configtool
這三種方法都可以打開Fcitx 5 :
一打開我就傻了,這個界面很陌生,能用的只有“雙拼”…
而且界面很拉垮,安裝的皮膚我還沒搞定,感興趣的同志可以參考:fcitx-skins
感悟就是:
沒辦法同時輸入多個文字,界面很拉跨,字體很小,序號較亂,輸入的字體總不是我想要的等等…
因為卸載了所以看不了詳細的圖片:
上岸
引用某個博主的原話:
之前一直用的是搜狗輸入法,因為20.04取消qt4了沒裝成,就去嘗試別的輸入法。后發(fā)現(xiàn)谷歌輸入法用起來極舒服,比sougou for linux好用。谷歌的中文輸入法主要是北京分部在做,對google cn的好感度飆升!!!(部分贊同~)
- Ctrl+Alt+T打開終端,輸入:
sudo apt-get install fcitx-googlepinyin
安裝fcitx-googlepinyin。
PS:這邊如果有其他的輸入法,要先干掉:
- 安裝完成后打開菜單欄,鍵盤輸入Language support并打開:
其實就是跟上面一樣:
設(shè)置—>「區(qū)域與語言」—>「管理已安裝的語言」
- 配置輸入法:
打開后才是熟悉的頁面:
關(guān)閉設(shè)置,谷歌輸入法配置完成??梢渣c擊右上角狀態(tài)欄的鍵盤圖片切換到谷歌輸入法:
切換輸入法的快捷鍵是ctrl+space,可以在剛關(guān)閉的輸入方法設(shè)置界面里第二項Global Config里修改快捷鍵。
熟悉的界面:
更新一發(fā):Gedit中文亂碼問題的解決
解決ubuntu利用gedit編輯出現(xiàn)中文亂碼的情況(這是因為我在用Halcon導(dǎo)入文本的時候發(fā)現(xiàn)的):
(適用于Ubuntu 11.10及以后),即Gedit 3.x 版本設(shè)置:
- 首先安裝dconf-editor:
sudo apt-get install dconf-editor
再運行:
dconf-editor
- 然后展開/org/gnome/gedit/preferences/encodings:
- candidate-encodings 的Value中加入 ‘GB18030’ ,加在UTF-8前面;
也可以直接使用命令:
gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"
參考:Gedit中文亂碼