强烈建议不要使用wayland

目前(2024年4月)为止,由于chrome,chromium,electron,flatpak引起的兼容性问题会导致linux系统的用户体验剧烈下降!!!

下面的操作只对部分应用有效。

在切换到GNOME的Wayland会话后,可能需要对不同的程序和系统配置进行一些调整以确保最佳的用户体验。以下是在这种环境下可能需要注意或重新设置的一些方面。

1. 添加各种平台框架的wayland参数

添加如下内容到~/.pam_environment并重启系统。

# Wayland compatibility
QT_QPA_PLATFORM         DEFAULT=wayland
# the following one causes gnome-control-center fail to show
#CLUTTER_BACKEND         DEFAULT=wayland
SDL_VIDEODRIVER         DEFAULT=wayland
MOZ_ENABLE_WAYLAND      DEFAULT=1
MOZ_WEBRENDER           DEFAULT=1
XDG_SESSION_TYPE        DEFAULT=wayland
XDG_CURRENT_DESKTOP     DEFAULT=sway

# QT-related theming
QT_QPA_PLATFORMTHEME    DEFAULT=qt5ct

# FCITX input-related
#GLFW_IM_MODULE         DEFAULT=ibus
GLFW_IM_MODULE          DEFAULT=fcitx
GTK_IM_MODULE           DEFAULT=fcitx
INPUT_METHOD            DEFAULT=fcitx
XMODIFIERS              DEFAULT=@im=fcitx
IMSETTINGS_MODULE       DEFAULT=fcitx
QT_IM_MODULE            DEFAULT=fcitx

~~注意这里禁用了CLUTTER_BACKEND,开启它会导致ubuntu22.04系统设置无法打开。~~

2. 中文输入法

fcitx4+搜狗无法正常使用,我直接切换到了fcitx5+rime。

3. 常用的软件

除了chrome浏览器的flags需要手动设置以外,其他的应用可以使用这个脚本来更新。

update_wayland.py

可以将该脚本复制到/usr/bin/,然后在/etc/apt/apt.conf.d下创建文件99-wayland-update,内容如下:

DPkg::Post-Invoke {"/usr/bin/update_wayland.py";};

则该脚本将在ubuntu apt upgrade以后,自动修改需要更新的软件的desktop文件。

Chrome浏览器

wayland

打开chrome://flags/,搜索Preferred Ozone platform,设置为wayland。

中文输入法

修改/usr/share/applications/google-chrome.desktop的Exec行,添加--gtk-version=4例如:

Exec=/usr/bin/google-chrome-stable %U --gtk-version=4

该方法可适用于多个应用,

修改基于electron的应用的参数

修改/usr/share/applications/slack.desktop,添加如下到Exec=/usr/bin/slack %U后面。

--ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

该方法可适用于多个应用。 vscode需要设置为--enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

4. 获取发送通知的应用信息

有时顶部通知不会显示应用的信息,通过如下方法可以获得发送通知的应用信息。该命令可以实时显示当前接收到的新通知。

dbus-monitor "interface='org.freedesktop.Notifications'" | \ grep --line-buffered "member=Notify\|string"

5. 去掉频繁的蓝牙通知

对于过多的蓝牙通知,可以通过禁用Blueman的ConnectionNotifier,battery插件来管理。

6. 其他配置备份

在进行重要的系统更改时,建议备份一些gnome的配置文件,例如:

mv ~/.config/dconf/user ~/.config/dconf/user.bak
mv ~/.config/gnome-control-center ~/.config/gnome-control-center.bak
mv ~/.config/gnome-session ~/.config/gnome-session.bak

7. gnome工作区的快捷键修改

使用dconf-editor来修改org/gnome/desktop/wm/keybindings/来修改快捷键

move-to-workspace-down将窗口移动到下一个动作区:<Shift><Super>Page_Down等。

8. 目前fcitx中文输入法仍无法使用的应用

vscode, typora,

Reference

https://askubuntu.com/questions/906708/how-to-find-out-which-application-is-sending-notifications/1134278#1134278

https://github.com/Ulauncher/Ulauncher/wiki/Hotkey-In-Wayland

https://www.omgubuntu.co.uk/2022/10/fix-firefox-blurry-wayland-fonts-ubuntu

https://github.com/fcitx/fcitx5/issues/263#issuecomment-855215782

https://github.com/blueman-project/blueman/issues/1556#issuecomment-863507029

https://www.reddit.com/r/Fedora/comments/tpsret/how_can_i_force_flatpak_apps_to_run_on_wayland/


文章版权归 FindHao 所有丨本站默认采用CC-BY-NC-SA 4.0协议进行授权|
转载必须包含本声明,并以超链接形式注明作者 FindHao 和本文原始地址:
https://findhao.net/easycoding/2616.html

Comments