pengwin-setup
pengwin-setup copied to clipboard
Is it possible to set the IME via im-config instead of environment variables?
-
I noticed that the fcitx and ibus installations of pengwin-setup both automatically invoke IME by setting environment variables. As follows.
-
https://github.com/WhitewaterFoundry/pengwin-setup/blob/eb08b58e513d428682378f3a16a79185d0a1b241/pengwin-setup.d/fcitx.sh
-
https://github.com/WhitewaterFoundry/pengwin-setup/blob/f8903b97765b87520f6f5c0b4a64329d3f34e6b7/pengwin-setup.d/ibus.sh
-
-
Corresponding to ibus, such a process can basically be equivalent to the following.
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'
-
Due to the discussion in https://github.com/ibus/ibus/issues/2458#issuecomment-1368985194, I'm a little bit confused why we don't automatically use im-config to switch input methods in
/etc/profile.d. Is it because im-config has some limitations on WSL? -
The result of my test on a WSL instance with systemd enabled is that every time the computer is restarted, the input method must be specified again through
im-config -n ibus, and it seems that im-config will not automatically save the settings. The method I'm testing looks like this.
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 # If ibus-gtk4 is available, you need to install
sudo apt-get install ibus-libpinyin -y # or other engine(s) you want
im-config -n ibus
ibus-setup # add input methods you want
- Since Gnome's standard desktop environment does not use im-config, does the processing of
pengwin-setup.d/ibus.shstill involve the limitation ofim-config?
Hello @linghengqian,
This installer was written before systemd was implemented in WSL, in fact, before WSL2. We need to check if this approach still works or if the im-config is the way. And we need to take the tests.
I'll put this in the roadmap to take care of.
Thanks for reporting.
Regards, Carlos
- @crramirez Hi, I found a more weird problem. The content of
/pengwin-setup.d/ibus.shis useful for Ubuntu WSL 22.04, but not for Pengwin WSL. I have opened https://github.com/WhitewaterFoundry/pengwin-setup/issues/396 to verify. - Do I need to close the current issue?
What I've found is that im-config makes the configuration assuming that the X server or Wayland server are running locally and put the environment variables in xorg startup files.
What I've found is that im-config makes the configuration assuming that the X server or Wayland server are running locally and put the environment variables in xorg startup files.
- It sounds like WSLg should have an X server or Wayland server? I admit I am a novice when it comes to X server or Wayland server. But https://github.com/microsoft/wslg/blob/v1.0.64/README.md#wslg-system-distro explains it this way.
The system distro is where all of the magic happens. The system distro is a containerized Linux environment where the WSLg XServer, Wayland server and Pulse Audio server are running. Communication socket for each of these servers are projected into the user distro so client applications can connect to them. We preconfigure the user distro environment variables DISPLAY, WAYLAND_DISPLAY and PULSE_SERVER to refer these servers by default so WSLg lights up out of the box.