Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/pengwin-setup.d/ibus.sh does not actually make ibus available in Pengwin WSL, but works in Ubuntu WSL #396

Open
linghengqian opened this issue Jul 12, 2024 · 2 comments

Comments

@linghengqian
Copy link

linghengqian commented Jul 12, 2024

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 test ibus.
# 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.
  • image
  • This honestly surprises me, since the same process is sufficient to get Ubuntu WSL to start ibus. See Lack of an application similar to gnome-startup-applications in Ubuntu WSL affects the use of ibus ubuntu/WSL#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. Because ibus-daemon has a -r parameter to kill existing old ibus-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
@crramirez
Copy link
Collaborator

What I've found is that if you delete the English input method, it actually works
image

@linghengqian
Copy link
Author

What I've found is that if you delete the English input method, it actually works

  • I realize that ibus-setup can only be configured via the GUI, which introduces a lot of variables. I will upload a video of configuring ibus under Pengwin WSL in the current issue or video website soon to verify the difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants