[手动选题][tech]: 20230516.0 ️ Guide to Set up Full Wayland with Arch Linux.md

This commit is contained in:
六开箱 2023-05-17 22:04:03 +08:00
parent 4c8882394e
commit 214120464b

View File

@ -0,0 +1,244 @@
[#]: subject: "Guide to Set up Full Wayland with Arch Linux"
[#]: via: "https://www.debugpoint.com/wayland-arch-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Guide to Set up Full Wayland with Arch Linux
======
**Is it possible to go full Wayland in Arch Linux using mainstream desktop environments or window managers? Lets find out.**
Wayland is a modern and efficient protocol for displaying graphical applications on Linux. It offers several advantages over the older X.Org display server, such as improved security, stability, and graphical performance.
While X.Org has been the go-to display server for many years, its age and complexity have led to various issues, including security vulnerabilities and compatibility problems with newer hardware. Wayland addresses these concerns by offering a more streamlined and secure display protocol.
However, its been almost a decade since the Wayland transition is going on, and it is understandable. Major Linux distributions, such as Ubuntu and Fedora already defaulted to Wayland sessions since 2021. The primary reason is the protocol is now stable enough.
However, Arch Linux users may find setting up a custom install with Wayland complex. Only KDE Plasma and GNOME have up-to-date Wayland support among all the mainstream desktop environments. Xfce, LXQt and other desktops are developing Wayland support, but they are not ready yet.
On the window manager front, Sway has full Wayland support in Arch Linux. That being said, I wanted to test how Wayland is performing in Arch and want to give you a status check as of today.
Lets try to set up KDE Plasma & GNOME in Arch Linux with full Wayland support.
### Set up Wayland in Arch Linux
Ideally, you should have the [base `wayland` package][1] installed already. Open a terminal and verify running the below command.
```
pacman -Qi wayland
```
If it is not installed, install it using:
```
sudo pacman -S --needed wayland
```
#### KDE Plasma Desktop
The following steps assume you have a bare metal Arch Linux installation without any desktop environment or window manager. You can install Arch Linux bare metal using the [great archinstall script][2].
Standard KDE Plasma setup in Arch Linux requires a few changes for Wayland. A few packages are needed from AUR, hence make sure to [set up Yay][3] or any other AUR helper.
Firstly, install a custom `sddm` display manager Wayland package from AUR using the following command. This is a different `sddm` package than the one available in the Arch “Extra” repo. As [per ArchWiki][4], only GDM and sddm-git have the proper Wayland support in Arch Linux at the moment.
```
yay -S sddm-git
```
Once installed, use the below command to install a few Wayland packages.
- xorg-xwayland: For running xclients under Wayland
- xorg-xlsclients: List client applications running on a display (optional)
- qt5-wayland: Qt APIs for Wayland
- glfw-wayland: GUI app dev packages for Wayland
```
pacman -S --needed xorg-xwayland xorg-xlsclients qt5-wayland glfw-wayland
```
Second, install the plasma and associated apps with Wayland sessions using the below set of commands. Execute them in the order mentioned below.
```
pacman -S --needed plasma kde-applications
```
```
pacman -S --needed plasma-wayland-session
```
**Note**: If you are using NVIDIA, you may want to install `egl-wayland`package. However, I have not tried it.
Lets install Firefox and Chromium as well, so that you can test Wayland is working properly.
```
pacman -S --needed firefox chromium
```
Once done, enable the display manager and NetworkManager service.
```
sudo systemctl enable sddmsudo systemctl enable NetworkManager
```
The sddm display manager needs a little more tweaks. Using any text editor, open the sddm configuration file and add `Current=breeze` under `[Theme]`.
```
sudo nano /usr/lib/sddm/sddm.conf.d/default.conf
```
```
[Theme]
# current theme name
Current=breeze
```
Once done, save and close the file. And reboot.
```
reboot
```
And in the login screen, you should see the Wayland option. Select and log in to the Wayland session of KDE Plasma in Arch Linux.
![Plasma Wayland session during login][5]
You can also verify [whether you are running Wayland][6] using $XDG_SESSION_TYPE variable.
![KDE Plasma with Wayland in Arch Linux][7]
If you want to force Firefox to use Wayland, then open `/etc/environment` and add the following line.
```
MOZ_ENABLE_WAYLAND=1
```
Then, reboot or run below to take effect.
```
source /etc/environment
```
Open Firefox and go to `about:support` to verify the value against “Window protocol”. You can also run `xlsclients` from the terminal to see which external apps are running under Wayland.
![Firefox is using xwayland in KDE Plasma with Arch][8]
So, that completes the KDE Plasma setup with Wayland in Arch Linux.
#### Performance of Wayland KDE Plasma session in Arch
Overall, the KDE Plasma in Wayland with Arch Linux works well. Nothing show-stopper or any major problems. The spectacle app is able to take screenshots and screencasts. That being said, a few things I noticed while testing the session.
Firstly there is an intermittent flicker in the bottom panel while launching applications such as Dolphin. Its inside the VirtualBox session.
Secondly, the mouse cursor behaviour is a little strange. The cursor is not changing its state from pointer to handle properly (see below).
Third, KWin crashed when returning online from a standby/screen off (in VirtualBox without guest additions). This might be specific to the virtual machine, but it required a hard reboot to go back to the desktop.
The memory consumption is around 2GB in idle Wayland sessions with Arch Linux.
#### GNOME
The following steps assume you have a bare metal Arch Linux installation without any desktop environment or window manager. You can install Arch Linux bare metal using the [great archinstall script][2].
The GDM display manager has full Wayland support in Arch Linux. First, install it using the below command:
```
pacman -S --needed gdm
```
Once installed, use the below command to install a few Wayland packages.
- xorg-xwayland: For running xclients under Wayland
- xorg-xlsclients: List client applications running on a display (optional)
- glfw-wayland: GUI app dev packages for Wayland
```
pacman -S --needed xorg-xwayland xorg-xlsclients glfw-wayland
```
Second, install the plasma and associated apps with Wayland sessions using the below set of commands. Execute them in the order mentioned below.
```
sudo pacman -S --needed gnome gnome-tweaks nautilus-sendto gnome-nettool gnome-usage gnome-multi-writer adwaita-icon-theme xdg-user-dirs-gtk fwupd arc-gtk-theme
```
**Note**: If you are using NVIDIA, you may want to install `egl-wayland`package. However, I have not tried it.
Lets install Firefox and Chromium as well, so that you can test Wayland is working properly with GNOME.
```
pacman -S --needed firefox chromium
```
Once done, enable the display manager and NetworkManager service.
```
sudo systemctl enable gdm
sudo systemctl enable NetworkManager
```
Once done, save and close the file. And reboot.
```
reboot
```
And in the login screen, you should see the _GNOME (Wayland)_ option. Select and log in to the Wayland session of GNOME in Arch Linux.
![GNOME with Wayland running in Arch Linux][9]
#### Performance of GNOME
If I compare GNOME and KDE Plasma, GNOME performed better with Wayland in Arch Linux. No significant problems or screen flickering in apps. This may be because of the recent changes done on GNOME 44 for Wayland, which landed in Arch Linux.
Also, Firefox runs natively in Wayland in GNOME, not using xwayland wrapper.
![Firefox with Wayland in GNOME][10]
### Troubleshooting common Wayland issues
While Wayland provides numerous benefits, you may encounter some challenges. Here are a few common issues and potential solutions:
- **Dealing with incompatible applications**: Some older or less commonly used applications may not yet have full Wayland support. Consider looking for alternative applications explicitly designed for Wayland or using XWayland as a compatibility layer.
- **Addressing performance-related concerns**: If you experience performance issues with specific applications, ensure you have installed the latest graphics drivers. Additionally, check if any specific compositor settings or application-specific tweaks can optimize performance.
- You can find **more tips** for troubleshooting [on this page][11].
### Conclusion
Setting up Wayland as your default display server in Arch Linux can significantly improve security, stability, and graphical performance. Following this guides installation and configuration steps, you can seamlessly transition from Xorg to Wayland and enjoy a more modern and efficient display experience.
However, you may find it a little complex for Arch Linux with Wayland since many items require special attention when things break.
I have not tested gaming on Arch with Wayland as part of this guide. Hence you may need to try that out after setting up. I hope this tutorial helps you to set up Wayland in Arch Linux.
Let me know how it goes for you in the comment box below.
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/wayland-arch-linux/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed/
[1]: https://archlinux.org/packages/extra/x86_64/wayland/
[2]: https://www.debugpoint.com/archinstall-guide/
[3]: https://www.debugpoint.com/install-yay-arch/
[4]: https://wiki.archlinux.org/title/wayland#Display_managers
[5]: https://www.debugpoint.com/wp-content/uploads/2023/05/Plasma-Wayland-session-during-login.jpg
[6]: https://www.debugpoint.com/check-wayland-or-xorg/
[7]: https://www.debugpoint.com/wp-content/uploads/2023/05/KDE-Plasma-with-Wayland-in-Arch-Linux.jpg
[8]: https://www.debugpoint.com/wp-content/uploads/2023/05/Firefox-is-using-xwayland-in-KDE-Plasma-with-Arch.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/05/GNOME-with-Wayland-running-in-Arch-Linux.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/05/Firefox-with-Wayland-in-GNOME.jpg
[11]: https://wiki.archlinux.org/title/wayland#Troubleshooting