Skip to content

Instantly share code, notes, and snippets.

@ivon852
Last active March 30, 2025 07:19
Show Gist options
  • Save ivon852/80eb95f3d0ba1c531645d89eb4876ddd to your computer and use it in GitHub Desktop.
Save ivon852/80eb95f3d0ba1c531645d89eb4876ddd to your computer and use it in GitHub Desktop.

1. 如何確認自己是使用Wayland工作階段

使用echo $XDG_SESSION_TYPE即可得知是x11還是wayland

GNOME 42後已預設使用Wayland,登入畫面GDM右下角齒輪會有GNOMEGNOME on Xorg的選項。

KDE Plasma 6後已預設使用Wayland,登入畫面SDDM左下角有Plasama (Wayland)Plasma (X11)的選項。

如果覺得Wayland問題過多,嘗試切換回X11工作階段。

2. 強制瀏覽器使用純Wayland工作階段

Wayland工作階段,Firefox(v121以上)預設會自動使用Wayland,不用再設定MOZ_ENABLE_WAYLAND=1了。開啟about:config頁面可得知是否正在使用Wayland。

Google Chrome(v131)預設仍是使用XWayland。使用google-chrome-stable --ozone-platform-hint=auto引數啟動Google Chrome,進入Wayland模式。

使用以下指令可得知是否正在使用Wayland:

strings `which google-chrome-stable` | grep WAYLAND_DISPLAY

3. 解決Fcitx5 Wayland無法輸入中文的問題

  1. 嘗試在/etc/environment加入環境變數,重開機。
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
SDL_IM_MODULE=fcitx
GLFW_IM_MODULE=ibus
  1. 編輯~/.local/share/applications/google-chrome.desktopExec=,在Google Chrome的啟動引數加上--ozone-platform-hint=auto --gtk-version=4 --enable-wayland-ime。才能於Google Chrome瀏覽器的Wayland工作階段喚醒Fcitx5輸入法。

4. 解決Wayland Google Meet共享畫面黑螢幕

  1. 確認有無安裝Pipewire套件,以及xdg-desktop-portal-gnomexdg-desktop-portal-kde套件,讓瀏覽器能透過XDG Portal存取螢幕。

  2. WebRTC Screen Sharing | Plugin-free測試共享畫面。

  3. Firefox與Chrome都跑在Wayland協定下的話,應該能順利分享螢幕。

  4. 跑在XWayland模式下的Google Chrome,開啟chrome://flags,將WebRTC PipeWire support設為Enabled,重啟。才能在GNOME共享螢幕。至於KDE Plasma 5.27以後有提供XWayland Video Bridge,應該能直接分享螢幕。

@y60yu1ii
Copy link

y60yu1ii commented May 4, 2024

目前你這篇是網路上唯一最完整且有用的。
我為了要打開fractional scaling 的時候字不會糊掉, 所以chrome本來就有指定 ozone platform.
但仍然無法打開fcitx 後來才發現要指定gtk version=4

@SakuraPuare
Copy link

thank, very useful for me

@pengchangg
Copy link

thinks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment