Difference between revisions of "Wayland (简体中文)"

From ArchWiki
Jump to navigation Jump to search
(Undo revision 391646 by BlueSummer (talk))
(flagged broken section links, simplification and beautification of wikilinks (interactive))
Tag: wiki-scripts
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:X Server (简体中文)]]
+
[[Category:X server (简体中文)]]
 
[[en:Wayland]]
 
[[en:Wayland]]
 
[[es:Wayland]]
 
[[es:Wayland]]
Line 9: Line 9:
 
{{Related2|Xorg (简体中文)|Xorg}}
 
{{Related2|Xorg (简体中文)|Xorg}}
 
{{Related articles end}}
 
{{Related articles end}}
{{TranslationStatus (简体中文)|Wayland|2013-03-30|252235}}
+
{{TranslationStatus (简体中文)|Wayland|2015-11-06|408148}}
'''Wayland''' 是 Linux 的一个新的图形接口协议,目的是替代有 25 年历史的 X11 Server。使用 Wayland 需要更改或重新安装一部分系统中的软件。更多关于 Wayland 的信息参见 [http://wayland.freedesktop.org/ 主页]。
+
'''Wayland''' 是 Linux 的一个新的图形接口协议。使用 Wayland 需要更改或重新安装一部分系统中的软件。更多关于 Wayland 的信息参见 [http://wayland.freedesktop.org/ 主页]。
 
 
{{警告|Wayland仍处于开发阶段,某些功能可能不完整}}
 
  
 
== 系统需求 ==
 
== 系统需求 ==
目前 Wayland 只能在使用了 [[Kernel Mode Setting (简体中文)|KMS]] 的系统上工作。
+
目前 Wayland 只能在使用了 [[Kernel mode setting (简体中文)|KMS]] 的系统上工作。
  
 
== 安装 ==
 
== 安装 ==
Line 23: Line 21:
  
 
== 使用 ==
 
== 使用 ==
Wayland 仅仅是一个库,无法单独工作。因此使用 Wayland 需要有混合程序(weston), Weston 演示程序、Qt5 加 Wayland 插件,还可以选择使用有 Wayland 支持的 GTK+ 库。
+
Wayland 仅仅是一个库,无法单独工作。若要代替X server,需要有混合器(如weston)
  
 
== Weston ==
 
== Weston ==
 
=== 安装 ===
 
=== 安装 ===
从 community 安装 {{pkg|weston}}
+
[[Help:Reading (简体中文)#安装软件包|安装]] {{Pkg|weston}}
  
 
=== 使用 ===
 
=== 使用 ===
安装完了 Wayland 及它所依赖的包之后,就可以开始试用了。切换到终端,运行:
+
安装完了 Wayland 及它所依赖的包之后,就可以开始试用了。运行:
 +
  $ weston
 +
或者,要试着运行Weston本身,切换到终端并运行:
 
   $ weston-launch
 
   $ weston-launch
{{Note|要运行 Westron,用户必须属于 video 组;不要以 root 执行此命令,否则 VT 可能冻结。}}
 
{{Note|If you get an LLVM assertion failure, you need to rebuild {{Pkg|mesa}} without Gallium LLVM until this problem is fixed. This may imply disabling some drivers which require LLVM.}}
 
 
如果 nouveau 驱动有问题,可以尝试运行:
 
  $ export EGL_DRIVER=/usr/lib/egl/egl_gallium.so
 
 
可以在 X 会话中运行 Weston:
 
$ weston
 
  
 
接下来你就可以在 TTY 下打开 wayland 的终端:
 
接下来你就可以在 TTY 下打开 wayland 的终端:
Line 52: Line 44:
 
显示图片:
 
显示图片:
 
  $ weston-image image1.jpg image2.jpg...
 
  $ weston-image image1.jpg image2.jpg...
 
显示 PDF 文件:
 
$ weston-view doc1.pdf doc2.pdf...
 
  
 
=== 配置 ===
 
=== 配置 ===
键盘布局,模块的选择,UI的修改的示例配置文件,请参阅{{ic|man weston.ini}}  
+
键盘布局,模块的选择,UI的修改的示例配置文件,请参阅{{man|5|weston.ini}}  
 
{{hc|~/.config/weston.ini|
 
{{hc|~/.config/weston.ini|
 
<nowiki>[core]
 
<nowiki>[core]
Line 86: Line 75:
 
#keymap_options=caps:ctrl_modifier,shift:both_capslock_cancel
 
#keymap_options=caps:ctrl_modifier,shift:both_capslock_cancel
 
### keymap_options from /usr/share/X11/xkb/rules/base.lst ###
 
### keymap_options from /usr/share/X11/xkb/rules/base.lst ###
 
  
 
[terminal]
 
[terminal]
 
#font=DroidSansMono
 
#font=DroidSansMono
 
#font-size=14
 
#font-size=14
 
 
  
 
[launcher]
 
[launcher]
Line 160: Line 146:
  
 
==== XWayland ====
 
==== XWayland ====
你可以在官方的 extra 库中找到{{Pkg|xorg-server-xwayland}}.
+
[[安装]]软件包{{Pkg|xorg-server-xwayland}}.
  
When you want to run an X application from within Weston, it spins up Xwayland to service the request. The following configuration file is required:
+
要通过 Weston 运行 X 程序,需要启动 Xwayland 进行请求处理。需要如下配置文件:
  
 
{{hc|~/.config/weston.ini|
 
{{hc|~/.config/weston.ini|
Line 170: Line 156:
  
 
==== 视频录制 ====
 
==== 视频录制 ====
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 {{ic|capture.wcap}} in the current working directory of Weston.  
+
Weston has build-in screencast recording which can be started and stopped by pressing the {{ic|Super+r}} key combination. Screencasts are saved to the file {{ic|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.  
 
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.  
Line 183: Line 169:
  
 
==== 高DPI显示器 ====
 
==== 高DPI显示器 ====
Use
+
For [[wikipedia:Retina_Display|Retina]] or [[HiDPI]] displays, use:
 +
 
 
{{hc|~/.config/weston.ini|
 
{{hc|~/.config/weston.ini|
 
<nowiki>
 
<nowiki>
Line 191: Line 178:
 
</nowiki>
 
</nowiki>
 
}}
 
}}
for "retina" or "HiDPI" displays.
+
 
 +
==== 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.
  
 
== 图形库 ==
 
== 图形库 ==
Line 202: Line 191:
  
 
Wayland 和 X 后端都启用时,GTK+ 默认会使用 X11。可以通过把{{ic|GDK_BACKEND}}环境变量设为{{ic|wayland}}来改变这一规则。
 
Wayland 和 X 后端都启用时,GTK+ 默认会使用 X11。可以通过把{{ic|GDK_BACKEND}}环境变量设为{{ic|wayland}}来改变这一规则。
 
如果出现 segment faults,删除{{pkg|libcanberra}}。0.31.0 之后的版本已经修复了这个问题。 [http://git.0pointer.de/?p=libcanberra.git;a=commit;h=c0620e432650e81062c1967cc669829dbd29b310 链接]。
 
  
 
=== Qt5 ===
 
=== Qt5 ===
  
=== 安装 ===
+
{{Grp|qt5}} 软件包已经提供了 Wayland 支持。 
从[[AUR]] 安装 {{AUR|qt5-base-git}},然后编译插件 {{AUR|qt5-wayland-git}}.
+
要使用 wayland 插件运行程序,需要设置 [[environment variable|环境变量]]. {{ic|1=QT_QPA_PLATFORM=wayland-egl}}  
 
 
要使用 wayland 插件运行程序,需要将 QT_QPA_PLATFORM 环境变量设置为 waylandgl。
 
$ export QT_QPA_PLATFORM=waylandgl
 
$ ./binaryname
 
  
 
===Clutter===
 
===Clutter===
Clutter 工具包有 Wayland 后端支持,可以作为 Wayland 程式运行。这一后端支持已经存在于开发主分支中[http://git.gnome.org/browse/clutter main repo],可以以 {{ic|1=--with-flavour=wayland}}来加以配置
+
Clutter 工具包有 Wayland 后端支持,可以作为 Wayland 程式运行。这一后端支持已经存在软件仓库的版本中。要配置 {{ic|CLUTTER_BACKEND&#61;wayland}}.
  
 
===SDL===
 
===SDL===
  
Benjamin Franzke 将 SDL 移植到 Wayland 上, 可以从freedesktop.org [http://cgit.freedesktop.org/~bnf/sdl-wayland/ sdl-wayland repo]处获得。Andre Heider 接着 Benjamin Franzke 的工作进行开发,代码在libsdl 的 [https://github.com/dhewg/libsdl/tree/wl wayland 分支]。
+
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 {{ic|SDL_VIDEODRIVER&#61;wayland}}.
  
 
=== GLFW ===
 
=== GLFW ===
 
+
Experimental wayland support is now in GLFW 3.1 and can be enabled with the {{ic|-DGLFW_USE_WAYLAND&#61;ON}} CMake option at compile time. You can also install the package {{AUR|glfw-wayland-git}} from the AUR.
Experimental wayland support is now in GLFW 3.1 and can be enabled with a CMake option at compile time. You can also install the package {{AUR|glfw3-git}} from the AUR and add {{ic|-DGLFW_USE_WAYLAND&#61;ON}} to the CMake flags.
 
 
 
  
 
===EFL===
 
===EFL===
Line 237: Line 218:
 
| GNOME
 
| GNOME
 
| Compositing
 
| Compositing
| 参见 [[GNOME#Starting GNOME]].
+
| 参见 [[GNOME#Starting GNOME]]{{Broken section link}}.
 
|-
 
|-
 
| Hawaii
 
| Hawaii
Line 249: Line 230:
 
| KDE
 
| KDE
 
| Compositing
 
| Compositing
| [[KDE]] 4.11 added support for [http://blog.martin-graesslin.com/blog/2013/06/starting-a-full-kde-plasma-session-in-wayland/ KWin under Wayland system compositor]. Since KDE 5.3 [https://community.kde.org/KWin/Wayland/ KWin is also able to be run nested] and can start an Xwayland server to support X11 clients under Wayland. Support for Wayland clients is planned for KDE 5.4.
+
| [[KDE]] 4.11 added support for [http://blog.martin-graesslin.com/blog/2013/06/starting-a-full-kde-plasma-session-in-wayland/ KWin under Wayland system compositor]. With [https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland 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
 
| Orbment
Line 276: Line 257:
 
|}
 
|}
  
==问题解决==
+
Some of installed wayland desktop clients might store information in {{ic|/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 {{Pkg|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 {{ic|[core]}} section:
 +
 
 +
{{hc|~/.config/weston.ini|
 +
<nowiki>[core]
 +
modules=xwayland.so,desktop-shell.so</nowiki>
 +
}}
 +
 
 +
生成:
 +
 
 +
{{hc|~/.config/weston.ini|
 +
<nowiki>[core]
 +
modules=xwayland.so</nowiki>
 +
}}
  
==更多信息==
+
== 参阅 ==
* [[Cursor Themes]]
+
* [[Cursor themes]]
[https://bbs.archlinux.org/viewtopic.php?id=107499 forum discussion] 页面将持续关注 Wayland 信息 ,如有兴趣请留意。
+
* [https://bbs.archlinux.org/viewtopic.php?id=107499 forum discussion] 页面将持续关注 Wayland 信息 ,如有兴趣请留意。

Latest revision as of 17:20, 1 May 2018

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

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

系统需求

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

安装

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

如果没有,可以从 官方软件仓库 安装软件包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的修改的示例配置文件,请参阅weston.ini(5)

~/.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[broken link: invalid section].
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

参阅