alacritty can't input Chinese and the title bar problem

Alacritty cannot switch to the Chinese input method under Ubuntu wayland, and the title bar also displays abnormally. It can be solved by configuring env WINIT_UNIX_BACKEND=x11 environment variables. Alacritty relies on Winit, which is a rust window processing library. After using Wayland by default This setting means switching to Xwayland without affecting other software. As shown below, add environment variables when starting.

 ➜ applications cat Alacritty.desktop
 [Desktop Entry]
 Type=Application
 TryExec=alacritty
 Exec=env WINIT_UNIX_BACKEND=x11 alacritty
 Icon=org.gnome.Terminal
 Terminal=false
 Categories=System;TerminalEmulator;

 Name=Alacritty
 GenericName=Terminal
 Comment=A fast, cross-platform, OpenGL terminal emulator
 StartupWMClass=Alacritty
 Actions=New;

 X-Desktop-File-Install-Version=0.26

 [Desktop Action New]
 Name=New Terminal
 Exec=env WINIT_UNIX_BACKEND=x11 alacritty
 ➜ applications pwd
 /usr/share/applications

This environment variable has 2 legal values x11 and wayland, explained as follows:

 /// - **Linux:** Backend type can be controlled using an environment variable
 /// `WINIT_UNIX_BACKEND`. Legal values are `x11` and `wayland`.
 /// If it is not set, winit will try to connect to a Wayland connection, and if that fails,
 /// will fall back on X11. If this variable is set with any other value, winit will panic.

Some people may ask, is it not possible under Wayland? Sorry, it’s really not working at the moment, see this issue, the world of Gnome is complicated.

After the change, you can input Chinese, and the title bar is also more beautiful. The effect is shown in the figure below. The title bar labeled 2 is indeed very original:

Alacritty title bar

2023-3-22 update:

Pull the latest master branch, compile and install the latest version, the title and Chinese input problems have been fixed.

1➜ cargo build --release --no-default-features --features=wayland
2➜ alacritty -V
3alacritty 0.13.0-dev (4b91a1db)

Those who are interested can use this version directly.

Lastmod: Monday, August 28, 2023

See Also:

Translations: