Files
nexus/wiki/concepts/Wayland.md

54 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Wayland"
type: concept
tags: [显示协议, Linux, 安全]
last_updated: 2026-04-14
---
# Wayland
Linux 新一代显示协议和窗口系统Ubuntu 24.04 默认使用,旨在替代传统的 X11。
## 基本信息
- **类型**:显示协议 / 窗口合成器
- **首个稳定版**2016年
- **官网**https://wayland.freedesktop.org
## 与 X11 的对比
| 特性 | Wayland | X11 |
|------|---------|-----|
| 架构 | 客户端直接与合成器通信 | 客户端通过 X Server 通信 |
| 安全性 | 沙箱隔离,应用间相互隔离 | 应用间共享内存,可互相截屏 |
| 性能 | 合成器直接渲染,减少拷贝 | 多次拷贝,延迟较高 |
| 兼容性 | 较新,部分旧应用可能不兼容 | 成熟稳定,兼容性好 |
| 远程桌面 | 支持但复杂PipeWire/RDP | 原生支持 VNC/xrdp |
| 驱动支持 | 依赖现代图形驱动 | 广泛支持 |
## 安全设计原则
Wayland 基于安全优先设计:
- 每个窗口独立合成,应用间无法直接访问其他窗口内容
- 屏幕录制/截屏需要用户显式授权(通过 PipeWire
- 外部程序无法在未授权状态下获取屏幕控制权
## 与远程桌面的冲突
Wayland 的安全设计导致以下问题:
- **RustDesk** 等远程桌面软件无法在 Login Screen未登录状态获取屏幕控制权
- VNC 传统方式无法直接工作
- 需要额外配置(如 PipeWire + xdg-desktop-portal才能实现屏幕共享
## Ubuntu 24.04 默认启用
Ubuntu 24.04 LTS 将 Wayland 作为默认显示协议,但仍可通过配置回退到 X11
```bash
# 编辑 GDM 配置
sudo nano /etc/gdm3/custom.conf
# 注释掉 WaylandEnable=false 以启用 Wayland默认已启用
# 取消注释 WaylandEnable=false 以强制使用 X11
```
## 相关概念
- [[X11]] — 传统显示协议Wayland 的前身)
- [[GDM3]] — GNOME Display Manager控制 Wayland/X11 切换
- [[RustDesk]] — 受 Wayland 安全限制影响的远程桌面软件