Alacritty 在 Ubuntu wayland 下无法切换到中文输入法,标题题栏也显示异常。
可通过配置 env WINIT_UNIX_BACKEND=x11 环境变量解决。
Alacritty 依赖 Winit,Winit 是一个 rust 窗口处理库,默认使用 Wayland 后端,这么设置的意思是切换到 Xwayland,不影响其它软件。
如下所示,启动的时候添加环境变量。
1➜ applications cat Alacritty.desktop
2[Desktop Entry]
3Type=Application
4TryExec=alacritty
5Exec=env WINIT_UNIX_BACKEND=x11 alacritty
6Icon=org.gnome.Terminal
7Terminal=false
8Categories=System;TerminalEmulator;
9
10Name=Alacritty
11GenericName=Terminal
12Comment=A fast, cross-platform, OpenGL terminal emulator
13StartupWMClass=Alacritty
14Actions=New;
15
16X-Desktop-File-Install-Version=0.26
17
18[Desktop Action New]
19Name=New Terminal
20Exec=env WINIT_UNIX_BACKEND=x11 alacritty
21➜ applications pwd
22/usr/share/applications
这个环境变量有 2 个合法值 x11 和 wayland,解释如下:
1/// - **Linux:** Backend type can be controlled using an environment variable
2/// `WINIT_UNIX_BACKEND`. Legal values are `x11` and `wayland`.
3/// If it is not set, winit will try to connect to a Wayland connection, and if that fails,
4/// will fall back on X11. If this variable is set with any other value, winit will panic.
有人可能会问,Wayland 下就不可以吗?抱歉,目前还真的不行,情况看这个issue,Gnome 的世界是复杂的。
更改后即可输入中文,标题栏也美观了些,效果如下图所示,标号 2 的标题栏的确非常原始:

2023-3-22 更新:
拉取最新 master 分支,编译安装最新版本,标题和中文输入的问题都已修复。
1➜ cargo build --release --no-default-features --features=wayland
2➜ alacritty -V
3alacritty 0.13.0-dev (4b91a1db)
有兴趣的可以直接使用这个版本。
Alacritty 在 Ubuntu wayland 下无法切换到中文输入法,标题题栏也显示异常。
可通过配置 env WINIT_UNIX_BACKEND=x11 环境变量解决。
Alacritty 依赖 Winit,Winit 是一个 rust 窗口处理库,默认使用 Wayland 后端,这么设置的意思是切换到 Xwayland,不影响其它软件。
如下所示,启动的时候添加环境变量。
1➜ applications cat Alacritty.desktop
2[Desktop Entry]
3Type=Application
4TryExec=alacritty
5Exec=env WINIT_UNIX_BACKEND=x11 alacritty
6Icon=org.gnome.Terminal
7Terminal=false
8Categories=System;TerminalEmulator;
9
10Name=Alacritty
11GenericName=Terminal
12Comment=A fast, cross-platform, OpenGL terminal emulator
13StartupWMClass=Alacritty
14Actions=New;
15
16X-Desktop-File-Install-Version=0.26
17
18[Desktop Action New]
19Name=New Terminal
20Exec=env WINIT_UNIX_BACKEND=x11 alacritty
21➜ applications pwd
22/usr/share/applications
这个环境变量有 2 个合法值 x11 和 wayland,解释如下:
1/// - **Linux:** Backend type can be controlled using an environment variable
2/// `WINIT_UNIX_BACKEND`. Legal values are `x11` and `wayland`.
3/// If it is not set, winit will try to connect to a Wayland connection, and if that fails,
4/// will fall back on X11. If this variable is set with any other value, winit will panic.
有人可能会问,Wayland 下就不可以吗?抱歉,目前还真的不行,情况看这个issue,Gnome 的世界是复杂的。
更改后即可输入中文,标题栏也美观了些,效果如下图所示,标号 2 的标题栏的确非常原始:

2023-3-22 更新:
拉取最新 master 分支,编译安装最新版本,标题和中文输入的问题都已修复。
1➜ cargo build --release --no-default-features --features=wayland
2➜ alacritty -V
3alacritty 0.13.0-dev (4b91a1db)
有兴趣的可以直接使用这个版本。