Solve the problem that VSCode cannot input Chinese under Arch
Nowadays, VSCode has many users. Three versions are included under Arch Linux, Code-OSS, Visual Studio Code and VSCodium. The world is always complicated. I chose Code-OSS because it is in Extra instead of AUR. The functions of the three are similar and the differences are not big. Just get used to the basic tool software. Hereinafter, we will call them vscode.
In the Linux Wayland environment, users will occasionally encounter various input method problems. Electron is the hardest hit area. vscode depends on Electron and Chromium as well.
If I remember correctly, Chromium has completely solved the input problem under Linux Wayland not long ago, eliminating a great pain for East Asian people (Electron can better support Chinese input after a certain version). Before that, I was forced to use Firefox all the time.
After a little trouble, it can accept Xwayland. In fact, most software has no problem by default. Back to the topic, vscode cannot switch the input method in the independent window manager Labwc, and it has always been in English input state. This problem has troubled me for a long time, and I have been waiting for Eletron to upgrade.
1Version: 1.101.0
2Commit: dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1
3Date: 2025-06-17T21:19:01.152Z
4Electron: 35.5.1
5ElectronBuildId: undefined
6Chromium: 134.0.6998.205
7Node.js: 22.15.1
8V8: 13.4.114.21-electron.0
9OS: Linux x64 6.15.2-arch1-1
I took a quick look and remembered that a version above 34 can input Chinese, and the prerequisite is that it has been met.
1. Solution
A configuration file to help you solve your problems:
1➜ ~ cat ~/.config/electron-flags.conf
2--enable-features=WaylandWindowDecorations
3--ozone-platform-hint=auto
4--enable-wayland-ime
5--wayland-text-input-version=3
The first two lines enable pure Wayland operation. If you don’t understand, you can refer to this link
The last two lines support Chinese input, among which --wayland-text-input-version=3
is more critical. Mature desktop environments such as KDE/Gnome may not need this (I haven’t tested it, I’m lazy and don’t want to test it, so I’m just guessing).
Labwc supports it in release version 0.7.2, submitted by a Japanese from Keio University:
Support input methods (or input method editors, commonly abbreviated IMEs) like Fcitx5, using protocols text-input-v3 and input-method-v2.
If you use a standalone window manager like me, you can try adding --wayland-text-input-version=3
, maybe you can happily input Chinese. I tested that --enable-wayland-ime
and --wayland-text-input-version=3
must be enabled at the same time in Labwc to input Chinese. I think Japanese and Korean are similar. After all, computers were not invented by East Asians. There are only dozens of keys on the keyboard and input methods are needed.
2. Others
If there are multiple software that Electron depends on, how to configure them separately:
The Electron package reads the ~/.config/electronXX-flags.conf file, where XX is the Electron version. If the version file does not exist, it falls back to the shared ~/.config/electron-flags.conf.
It is worth mentioning that the English and Chinese content of the Arch wiki may be inconsistent. If you don’t believe it, take a look at this link. The Chinese version contains additional instructions for input methods, which are not available in English or Japanese. The Chinese maintainer is a hardworking little bee. Thumbs up 👍.
Although the input method solution is not applicable to my situation, it provides ideas.
It can be seen that in the Linux Wayland Labwc environment, solving the Chinese input problem is not a one-time solution, and the link is relatively long (new Linux users don’t need to be afraid, most software is fine).
Generally speaking, environment variables are the first hurdle:
1
2➜ ~ cat .config/labwc/environment
3#Example environment file
4
5# This allows xdg-desktop-portal-wlr to function (e.g. for screen-recording)
6XDG_CURRENT_DESKTOP=wlroots
7
8# Set keyboard layout to Swedish
9# XKB_DEFAULT_LAYOUT=se
10XKB_DEFAULT_LAYOUT=us
11
12# Set two keyboard layouts and toggle between them using alt+shift
13#XKB_DEFAULT_LAYOUT=se,de
14#XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle
15
16# Force firefox to use wayland backend
17MOZ_ENABLE_WAYLAND=1
18
19# Set cursor theme.
20# Find icons themes with the command below or similar:
21# find /usr/share/icons/ -type d -name "cursors"
22XCURSOR_THEME=breeze_cursors
23
24# Disable hardware cursors. Most users wouldn't want to do this, but if you
25# are experiencing issues with disappearing cursors, this might fix it.
26#WLR_NO_HARDWARE_CURSORS=1
27
28# For Java applications such as JetBrains/Intellij Idea, set this variable
29# to avoid menus with incorrect offset and blank windows
30# See https://github.com/swaywm/sway/issues/595
31#_JAVA_AWT_WM_NONREPARENTING=1
32_JAVA_AWT_WM_NONREPARENTING=1
33#
34
35# fcitx5
36QT_IM_MODULE=fcitx
37XMODIFIERS=@im=fcitx
38INPUT_METHOD=fcitx
39SDL_IM_MODULE=fcitx
This is mentioned in most online materials. Secondly, the configuration of the input method engine Ibus
and Fcitx
is the second level.
Then there is the different support of DE (KDE/Gnome/Xfce/COSMIC) or WM (such as Labwc, Sway), which is the third level.
The last level is the software itself. For example, Electron must be higher than a certain version (I forgot which version it is, you can search it yourself, it seems to be 34), which is the fourth level.
The most painful thing is that the software itself does not support it. For example, Dota2
did not work when it was first released, and Chromium had to wait for an upgrade.
3. Screenshot Proof
After saying so much, there is no truth without pictures, so here is a screenshot:
It can be seen that the function is normal. If readers think it is helpful, following my public account is also one of the ways to support. After all, it takes more than 2 hours to write each article. In the Labwc environment, the solution to this problem should be unique in the Chinese world, at least I haven't found it yet.
Copyright statement:
- All content that is not sourced is original., please do not reprint without authorization (because the typesetting is often disordered after reprinting, the content is uncontrollable, and cannot be continuously updated, etc.);
- For non-profit purposes, to deduce any content of this blog, please give the relevant webpage address of this site in the form of 'source of original text' or 'reference link' (for the convenience of readers).
See Also:
- Mini console assembly notes
- Greetd and greetd tutorial
- Gif screen recording in Wayland environment
- labwc environment enables wlogout
- Quickly hide and call out the terminal
- My Toolbox
- Labwc replaces customized skin
- Labwc Convenient Configuration
- Window manager labwc usage notes
- Solution to the problem of screen recording failure under independent window manager