Wayland (简体中文) - ArchWiki

# Wayland (简体中文)

相关文章

- Kernel Mode Setting (简体中文)
- Xorg

翻译状态： 本文是英文页面 Wayland 的翻译，最后翻译时间：2015-11-06，点击这里可以查看翻译后英文页面的改动。

Wayland 是 Linux 的一个新的图形接口协议。使用 Wayland 需要更改或重新安装一部分系统中的软件。更多关于 Wayland 的信息参见 主页。

## 系统需求

目前 Wayland 只能在使用了 KMS 的系统上工作。

## 安装

注意: Wayland 应该已经作为gtk2和gtk3的依赖安装到系统里面

如果没有，可以从 官方软件仓库 安装软件包wayland。

## 使用

Wayland 仅仅是一个库，无法单独工作。若要代替X server,需要有混合器(如weston)

## Weston

### 安装

安装 weston 包

### 使用

安装完了 Wayland 及它所依赖的包之后，就可以开始试用了。运行：

     $ weston

或者，要试着运行Weston本身，切换到终端并运行:

     $ weston-launch

接下来你就可以在 TTY 下打开 wayland 的终端：

    $ weston-terminal

在屏幕上移动一朵花儿，用以测试帧控制功能：

    $ weston-flower

在 Wayland 上运行 glxgears 程序：

    $ weston-gears

显示图片：

    $ weston-image image1.jpg image2.jpg...

### 配置

键盘布局，模块的选择，UI的修改的示例配置文件，请参阅`man weston.ini`

    ~/.config/weston.ini

    [core]
    ### uncomment this line for xwayland support ###
    #modules=xwayland.so

    [shell]
    background-image=/usr/share/backgrounds/gnome/Aqua.jpg
    background-color=0xff002244
    panel-color=0x90ff0000
    locking=true
    animation=zoom
    #binding-modifier=ctrl
    #num-workspaces=6
    ### for cursor themes install xcursor-themes pkg from Extra. ###
    #cursor-theme=whiteglass
    #cursor-size=24

    ### tablet options ###
    #lockscreen-icon=/usr/share/icons/gnome/256x256/actions/lock.png
    #lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
    #homescreen=/usr/share/backgrounds/gnome/Blinds.jpg
    #animation=fade

    [keyboard]
    keymap_rules=evdev
    #keymap_layout=gb
    #keymap_options=caps:ctrl_modifier,shift:both_capslock_cancel
    ### keymap_options from /usr/share/X11/xkb/rules/base.lst ###

    [terminal]
    #font=DroidSansMono
    #font-size=14

    [launcher]
    icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
    path=/usr/bin/gnome-terminal

    [launcher]
    icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
    path=/usr/bin/weston-terminal

    [launcher]
    icon=/usr/share/icons/hicolor/24x24/apps/firefox.png
    path=/usr/bin/firefox

    [launcher]
    icon=/usr/share/icons/gnome/24x24/apps/arts.png
    path=./clients/flower

    [screensaver]
    # Uncomment path to disable screensaver
    path=/usr/libexec/weston-screensaver
    duration=600

    [input-method]
    path=/usr/libexec/weston-keyboard

    ###  for Laptop displays  ###
    #[output]
    #name=LVDS1
    #mode=1680x1050
    #transform=90

    #[output]
    #name=VGA1
    # The following sets the mode with a modeline, you can get modelines for your preffered resolutions using the cvt utility
    #mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    #transform=flipped

    #[output]
    #name=X1
    #mode=1024x768
    #transform=flipped-270

简单的 `weston.ini` :

    ~/.config/weston.ini

    [core]
    modules=xwayland.so

    [keyboard]
    keymap_layout=gb

    [launcher]
    icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
    path=/usr/bin/weston-terminal

    [launcher]
    icon=/usr/share/icons/hicolor/24x24/apps/firefox.png
    path=/usr/bin/firefox

    [output]
    name=LVDS1
    mode=1680x1050
    transform=90

#### XWayland

安装软件包xorg-server-xwayland.

要通过 Weston 运行 X 程序，需要启动 Xwayland 进行请求处理。需要如下配置文件：

    ~/.config/weston.ini

    [core]
    modules=xwayland.so

#### 视频录制

Weston has build-in screencast recording which can be started and stopped by pressing the `Super+r` key combination. Screencasts are saved to the file `capture.wcap` in the current working directory of Weston.

The WCAP format is a lossless video format specific to Weston, which only records the difference in frames. To be able to play the recorded screencast, the WCAP file will need to be converted to a format which a media player can understand.

To convert the file to webm, execute:

    $ wcap-decode capture.wcap --yuv4mpeg2 | vpxenc --target-bitrate=1024 --best -t 4 -o foo.webm -

To convert the file to ogv, execute:

    $ wcap-decode capture.wcap --yuv4mpeg2 | theora_encode - -o cap.ogv

#### 高DPI显示器

For Retina or HiDPI displays, use:

    ~/.config/weston.ini

    [output]
    name=...
    scale=2

#### Shell font

Weston uses the default sans-serif font for window title bars, clocks, etc. See Font configuration#Replace or set default fonts for instructions on how to change this font.

## 图形库

在官方资料上查看详细信息

### GTK+ 3

[extra]软件仓库中的gtk3 已经提供了 Wayland 支持.

GTK+ 3.0 开始，GTK+ 可以在运行时同时支持多个后端，和 Qt 一样进行切换。

Wayland 和 X 后端都启用时，GTK+ 默认会使用 X11。可以通过把`GDK_BACKEND`环境变量设为`wayland`来改变这一规则。

### Qt5

qt5 软件包已经提供了 Wayland 支持。 要使用 wayland 插件运行程序，需要设置 环境变量. `QT_QPA_PLATFORM=wayland-egl`

### Clutter

Clutter 工具包有 Wayland 后端支持，可以作为 Wayland 程式运行。这一后端支持已经存在软件仓库的版本中。要配置 `CLUTTER_BACKEND=wayland`.

### SDL

Experimental wayland support is now in SDL 2.0.2 and enabled by default on Arch Linux.To run a SDL application on Wayland, set `SDL_VIDEODRIVER=wayland`.

### GLFW

Experimental wayland support is now in GLFW 3.1 and can be enabled with the `-DGLFW_USE_WAYLAND=ON` CMake option at compile time. You can also install the package glfw-wayland-gitAUR from the AUR.

### EFL

EFL 已经完全支持 Wayland。请参考这里获取更多细节。

## 窗口管理器和桌面 shell

Name | Type | Description
--- | --- | ---
GNOME | Compositing | 参见 GNOME#Starting GNOME.
Hawaii | (Unclear) | 参见 Hawaii.
sway | Tiling | Sway is an i3-compatible window manager for Wayland.
KDE | Compositing | KDE 4.11 added support for KWin under Wayland system compositor. With KDE Plasma 5.4, the first technology preview of a Wayland session is released but it is currently targeted for the mobile platform and does not yet allow to use it as a full replacement for Xorg based desktop.
Orbment | Tiling | orbment (previously loliwm) is a tiling WM for Wayland.
Velox | Tiling | velox is a simple window manager based on swc. It is inspired by dwm and xmonad.
Orbital | Compositing | Orbital is a Wayland compositor and shell, using Qt5 and Weston. The goal of the project is to build a simple yet flexible and good looking Wayland desktop. It is not a full fledged DE but rather the analogue of a WM in the X11 world, such as Awesome or Fluxbox.
Papyros Shell | (Unclear) | Papyros Shell is the desktop shell for Papyros, built using QtQuick and QtCompositor as a compositor for Wayland.
Maynard | (Unclear) | Maynard is a desktop shell client for Weston based on GTK. It was based on weston-gtk-shell, a project by Tiago Vignatti.
Motorcar | (Unclear) | Motorcar is a wayland compositor to explore 3D windowing.

Some of installed wayland desktop clients might store information in `/usr/share/wayland-sessions/*.desktop` files about how to start them in wayland.

## 疑难解答

### LLVM assertion failure

If you get an LLVM assertion failure, you need to rebuild mesa without Gallium LLVM until this problem is fixed.

This may imply disabling some drivers which require LLVM. You may also try exporting the following, if having problems with hardware drivers:

    $ export EGL_DRIVER=/usr/lib/egl/egl_gallium.so

### Weston fails to launch after update to 1.7

This is possibly caused by the `desktop-shell.so` module being loaded by your weston.ini. This used to be required, but is not anymore.

Remove it from the `[core]` section:

    ~/.config/weston.ini

    [core]
    modules=xwayland.so,desktop-shell.so

生成：

    ~/.config/weston.ini

    [core]
    modules=xwayland.so

## 参阅

- Cursor themes
- forum discussion 页面将持续关注 Wayland 信息 ，如有兴趣请留意。

Category:

- X server (简体中文)