pengwin-setup
pengwin-setup copied to clipboard
`/pengwin-setup.d/ibus.sh` does not actually make ibus available in Pengwin WSL, but works in Ubuntu WSL
-
/pengwin-setup.d/ibus.sh
does not actually make ibus available in Pengwin WSL, but works in Ubuntu WSL. Refer to https://github.com/WhitewaterFoundry/pengwin-setup/blob/d561920b8e04fcf8a8f0861d27c90ce4fd82f9f6/pengwin-setup.d/ibus.sh . - The logic of this file is roughly as follows.
sudo apt-get install ibus ibus-gtk ibus-gtk3 fonts-noto-cjk fonts-noto-color-emoji dbus-x11 zenity -y
sudo apt-get install ibus-gtk4 -y
sudo apt-get install ibus-libpinyin -y
export XIM=ibus
export XIM_PROGRAM=/usr/bin/ibus
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export DefaultIMModule=ibus
sudo sh -c 'echo "export XIM=ibus" > /etc/profile.d/ibus.sh'
sudo sh -c 'echo "export XIM_PROGRAM=/usr/bin/ibus" >> /etc/profile.d/ibus.sh'
sudo sh -c 'echo "export QT_IM_MODULE=ibus" >> /etc/profile.d/ibus.sh'
sudo sh -c 'echo "export GTK_IM_MODULE=ibus" >> /etc/profile.d/ibus.sh'
sudo sh -c 'echo "export XMODIFIERS=@im=ibus" >> /etc/profile.d/ibus.sh'
sudo sh -c 'echo "export DefaultIMModule=ibus" >> /etc/profile.d/ibus.sh'
ibus-daemon -x -d
ibus-setup
sudo pkill ibus-daemon
ibus-daemon -x -d
sudo sh -c 'echo "ibus-daemon -drx > /dev/null 2>&1" >> /etc/profile.d/ibus.sh'
- That is, execute the following command.
# On Pengwin WSL
pengwin-setup update
sudo apt update && sudo apt upgrade -y
# In the current issue, it is set to `zh_CN.UTF-8 UTF-8`.
sudo dpkg-reconfigure locales
# Before executing `echo $LANG`, open a new Pengwin WSL shell. Make sure `echo $LANG` outputs `zh_CN.UTF-8`.
echo $LANG
# install GUI -> NLI -> IBUS. Select libpinyin. Select libpinyin for the ibus engine. All other options are y.
pengwin-setup
- At this time, you may wish to use
microsoft-edge
to testibus
.
# Restart WSL by executing `wsl --shutdown` in Windows PowerShell 5.1 or PowerShell 7.
# Open a new Pengwin WSL Shell.
# On Pengwin WSL
# Install Microsoft Edge to test
cd /tmp/
wget https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_122.0.2365.92-1_amd64.deb?brand=M102 -O ./microsoft-edge-stable.deb
sudo apt install --fix-missing ./microsoft-edge-stable.deb -y
microsoft-edge
- At this point, ibus cannot be used in microsoft-edge.
-
- This honestly surprises me, since the same process is sufficient to get Ubuntu WSL to start ibus. See https://github.com/ubuntu/WSL/issues/483 . The only difference is that there is no apt-get package named
language-pack-gnome-zh-hans-base
in Pengwin WSL.sudo sh -c 'echo "ibus-daemon -drx > /dev/null 2>&1" >> /etc/profile.d/ibus.sh'
doesn't seem to have any effect. Becauseibus-daemon
has a-r
parameter to kill existing oldibus-daemon
processes, you can actually simplify the commands executed.
# On Ubuntu WSL 22.04
sudo apt update && sudo apt upgrade -y
# In the current issue, it is set to `zh_CN.UTF-8`.
sudo dpkg-reconfigure locales
# Before executing `echo $LANG`, open a new Ubuntu WSL shell. Make sure `echo $LANG` outputs `zh_CN.UTF-8`.
echo $LANG
# I would say this will provide a Chinese GUI for `ibus-setup`.
sudo apt install language-pack-gnome-zh-hans-base -y
cd /tmp/
# Install Microsoft Edge
wget https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_122.0.2365.92-1_amd64.deb?brand=M102 -O ./microsoft-edge-stable.deb
sudo apt install --fix-missing ./microsoft-edge-stable.deb -y
# Install the input method framework `ibus` and the input method editor `ibus-libpinyin`
sudo apt-get install fonts-noto-cjk fonts-noto-color-emoji dbus-x11 zenity -y
sudo apt-get install ibus-libpinyin -y
sh -c 'echo "export GTK_IM_MODULE=ibus" >> ~/.bashrc'
sh -c 'echo "export XMODIFIERS=@im=ibus" >> ~/.bashrc'
sh -c 'echo "export QT_IM_MODULE=ibus" >> ~/.bashrc'
source ~/.bashrc
ibus-daemon -dxr
# Add Input Method `中文 -> 智能拼音`
ibus-setup
# Restart WSL by executing `wsl --shutdown` in Windows PowerShell 5.1 or PowerShell 7.
# Open a new Ubuntu WSL Shell.
ibus-daemon -dxr
microsoft-edge