alacritty無法輸入中文以及標題欄問題

Alacritty在Ubuntu wayland下無法切換到中文輸入法,標題題欄也顯示異常,可通過配置 env WINIT_UNIX_BACKEND=x11 環境變量解決,Alacritty依賴Winit,Winit是一個rust窗口處理庫,默認使用Wayland後端,這麼設置的意思是切換到Xwayland,不影響其它軟件,如下所示,啓動的時候添加環境變量。

➜  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

這個環境變量有2個合法值x11和wayland,解釋如下:

/// - **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.

有人可能會問,Wayland下就不可以嗎?抱歉,目前還真的不行,情況看這個issue,Gnome的世界是複雜的。

更改後即可輸入中文,標題欄也美觀了些,效果如下圖所示,標號2的標題欄的確非常原始:

Alacritty title bar

2023-3-22更新:

拉取最新master分支,編譯安裝最新版本,標題和中文輸入的問題都已修復。

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

有興趣的可以直接使用這個版本。

相關文章:

翻譯: