Difference between revisions of "Wayland"

From ArchWiki
Jump to: navigation, search
(Undid unilateral deletion of Pure Wayland (section worked on by several users) without discussion.)
(34 intermediate revisions by 11 users not shown)
Line 8: Line 8:
 
{{Article summary wiki|KMS}}
 
{{Article summary wiki|KMS}}
 
{{Article summary wiki|Xorg}}
 
{{Article summary wiki|Xorg}}
 +
{{Article summary wiki|Mir}}
 
{{Article summary end}}
 
{{Article summary end}}
 
 
'''Wayland''' is a new windowing protocol for Linux. Utilization of Wayland requires changes to and re-installation of parts of your system's software. For more information on Wayland see its [http://wayland.freedesktop.org/ homepage].
 
'''Wayland''' is a new windowing protocol for Linux. Utilization of Wayland requires changes to and re-installation of parts of your system's software. For more information on Wayland see its [http://wayland.freedesktop.org/ homepage].
  
Line 15: Line 15:
  
 
== Requirements ==
 
== Requirements ==
 +
 
Currently Wayland will only work with on a system that is utilizing [[KMS]].
 
Currently Wayland will only work with on a system that is utilizing [[KMS]].
  
 
== Installation ==
 
== Installation ==
Wayland is most probably installed on your system already as it is an indirect dependency of {{pkg|gtk2}} and {{pkg|gtk3}}.  If it is not installed, you will find the {{pkg|wayland}} package in extra.
+
 
 +
Wayland is most probably installed on your system already as it is an indirect dependency of {{Pkg|gtk2}} and {{Pkg|gtk3}}.  If it is not installed, you will find the {{Pkg|wayland}} package in the [[official repositories]].
  
 
== Usage ==
 
== Usage ==
 +
 
As Wayland is only a library, it is useless on its own. To use it, you need a compositor (like Weston), Weston demo applications, Qt5 with Wayland plugin, and/or GTK+ with Wayland support.
 
As Wayland is only a library, it is useless on its own. To use it, you need a compositor (like Weston), Weston demo applications, Qt5 with Wayland plugin, and/or GTK+ with Wayland support.
  
 
== Weston ==
 
== Weston ==
 +
 
=== Installation ===
 
=== Installation ===
You need to install {{pkg|weston}} from community.
+
 
 +
You need to install {{Pkg|weston}} from the official repositories.
  
 
=== Usage ===
 
=== Usage ===
 +
 +
{| style="float:right;border:1px #cccccc solid;margin:5px;padding:5px;width:200px;"
 +
|+ ''Keyboard shortcuts (super = windows key)'' {{Ic|Ctrl-b}}
 +
!Cmd
 +
!Action
 +
|-
 +
|Ctrl + Alt + Backspace
 +
|Quit weston
 +
|-
 +
|Super + Scroll / PageUpDown
 +
|Zoom into desktop
 +
|-
 +
|Super + Tab
 +
|Switch windows
 +
|}
 +
 
Now that Wayland and its requirements are installed you should be ready to test it out. Try switching to a terminal and running:
 
Now that Wayland and its requirements are installed you should be ready to test it out. Try switching to a terminal and running:
 
  $ weston-launch
 
  $ weston-launch
{{Note|You need to be in the video group for Weston to start; this command is not supposed to be run as root and doing that may freeze your VT. }}
+
{{Note|
{{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.}}
+
* You need to be in the video group for Weston to start; this command is not supposed to be run as root and doing that may freeze your VT.
 +
* 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:  
 
You may also try exporting the following, if having problems with hardware drivers:  
Line 53: Line 76:
 
To display PDF Files:
 
To display PDF Files:
 
  $ weston-view doc1.pdf doc2.pdf...
 
  $ weston-view doc1.pdf doc2.pdf...
 +
 +
=== Configuration ===
 +
Example configuration file for keyboard layout, module selection and UI modifications:
 +
{{hc|~/.config/weston.ini|
 +
<nowiki>[keyboard]
 +
keymap_layout=en
 +
 +
[shell]
 +
type=desktop-shell.so
 +
background-image=/path/to/your/wallpaper.jpg
 +
background-color=0xff002244
 +
panel-color=0x90ff0000
 +
locking=true
 +
animation=zoom
 +
binding-modifier=ctrl
 +
num-workspaces=6
 +
 +
#type=tablet-shell.so
 +
#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
 +
 +
[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
 +
 +
[screensaver]
 +
# Uncomment path to disable screensaver
 +
path=/usr/libexec/weston-screensaver
 +
duration=600
 +
 +
#[output]
 +
#name=LVDS1
 +
#mode=1680x1050
 +
#transform=90
 +
 +
#[output]
 +
#name=VGA1
 +
#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
 +
#transform=flipped
 +
 +
#[output]
 +
#name=X1
 +
#mode=1024x768
 +
#transform=flipped-270</nowiki>
 +
}}
 +
==== XWayland ====
 +
If you plan to run X-applications that don't support Wayland, you have to install {{AUR|xorg-server-xwayland-git}} and either patched graphic drivers according to your system, e.g. {{AUR|xf86-video-intel-xwayland-git}}, or the generic wlglamor fallback found at {{AUR|xf86-video-wlglamor-git}}. After that, create or modify following configuration file:
 +
{{hc|~/.config/weston.ini|
 +
<nowiki>[core]
 +
modules=xwayland.so,desktop-shell.so</nowiki>
 +
}}
 +
Now you can also run X applications in some kind of "compatibility mode".
  
 
== GUI libraries ==
 
== GUI libraries ==
([http://wayland.freedesktop.org/toolkits.html page from official website])
 
  
===GTK+===
+
(See details on the [http://wayland.freedesktop.org/toolkits.html official website])
 +
 
 +
=== GTK+ ===
  
You need to install {{pkg|gtk3}} from extra, which now has the Wayland backend enabled.
+
You need to install {{Pkg|gtk3}} from the official repositories, which now has the Wayland backend enabled.
  
 
With GTK+ 3.0, GTK+ gained support for multiple backends at runtime and can switch between backends in the same way Qt can with lighthouse.
 
With GTK+ 3.0, GTK+ gained support for multiple backends at runtime and can switch between backends in the same way Qt can with lighthouse.
  
When both Wayland and X backends are enabled, GTK+ will default to the X11 backend, but this can be overridden by setting the <code>GDK_BACKEND</code> environment variable to <code>wayland</code>.
+
When both Wayland and X backends are enabled, GTK+ will default to the X11 backend, but this can be overridden by modifying an environment variable: {{ic|GDK_BACKEND&#61;wayland}}.
  
Remove {{pkg|libcanberra}} if you get segmentation faults when running gtk applications. A [http://git.0pointer.de/?p=libcanberra.git;a=commit;h=c0620e432650e81062c1967cc669829dbd29b310 fix] for these segfaults has been committed as of 9 Nov 2012, so presumably as soon as 0.31.0 comes out, this should not be necessary anymore. The AUR contains a working git based {{aur|libcanberra-git}} if you want to keep the functionality.
+
=== Qt5 ===
  
===Qt5===
+
You need to install {{Pkg|qt5-base}} and the wayland plugin {{AUR|qtwayland-git}}.
  
You need to install {{pkg|qt5-base}} and the wayland plugin - {{aur|qt5-qtwayland-git}}.
+
To run a Qt5 app with the Wayland plugin, set {{ic|QT_QPA_PLATFORM&#61;wayland-egl}}.
  
To run a Qt5 app with the Wayland plugin, set QT_QPA_PLATFORM=wayland-egl.
+
=== Clutter ===
  
===Clutter===
+
The Clutter toolkit has a Wayland backend that allows it to run as a Wayland client. The backend is enabled in the official package in extra.
  
The Clutter toolkit has a Wayland backend that allows it to run as a Wayland client. The backend is in the master branch of the [http://git.gnome.org/browse/clutter main repo] and can be activated by passing <code>--with-flavour=wayland</code> to the configure script.
+
To run a Clutter app on Wayland, set {{ic|CLUTTER_BACKEND&#61;wayland}}.
  
===SDL===
+
=== SDL ===
  
Benjamin Franzke is working on a port of SDL to Wayland, it's available in his [http://cgit.freedesktop.org/~bnf/sdl-wayland/ sdl-wayland repo] on freedesktop.org. Further development upon Benjamins work was done by Andre Heider in his [https://github.com/dhewg/libsdl/tree/wl wayland branch] of libsdl.
+
Benjamin Franzke is working on a port of SDL to Wayland, it's available in his [http://cgit.freedesktop.org/~bnf/sdl-wayland/ sdl-wayland repo] on freedesktop.org. Further development upon Benjamins work was done by Andre Heider in his [https://github.com/dhewg/libsdl/tree/wl wayland branch] of libsdl. Scott Moreau picked up where others left and fixed the library to work with 1.0 protocol. You can find his work in [https://github.com/soreau/SDL/tree/wayland wayland branch] of SDL repository.
  
===EFL===
+
To run a SDL application on Wayland, set {{ic|SDL_VIDEODRIVER&#61;wayland}}.
  
EFL has complete Wayland support. Please see [http://trac.enlightenment.org/e/wiki/Wayland here] for details.
+
=== EFL ===
  
==Window managers and desktop shells==
+
EFL has complete Wayland support.
 +
To run a EFL application on Wayland, see Wayland [http://wayland.freedesktop.org/efl.html project page].
  
===KDE===
+
== Window managers and desktop shells ==
  
There is [http://blog.martin-graesslin.com/blog/2011/03/kwin-at-gsoc-2011/ early work] to make it possible to run KWin (KDE's window manager) on Wayland.
+
=== KDE ===
  
===GNOME===
+
KDE 4.11 beta supports starting [http://blog.martin-graesslin.com/blog/2013/06/starting-a-full-kde-plasma-session-in-wayland/ KWin under Wayland system compositor]. There is currently no support for using KWin as a session compositor.
  
GNOME is currently ported to Wayland and will be available in a future version. For details look into the [https://live.gnome.org/Wayland GNOME Wiki].
+
=== GNOME ===
 +
Since version 3.10, Gnome has experimental Wayland support but you have to install {{AUR|xwayland-git}} and a equivalent patched graphics driver, e.g. {{AUR|xf86-video-intel-xwayland-git}} to get ''Mutter'' to work. For details look into the [https://live.gnome.org/Wayland GNOME wiki].
 +
{{bc|<nowiki>gnome-session --session=gnome-wayland</nowiki>}}
  
===Pure Wayland===
+
=== i3 ===
  
{{Warning|Some really quick notes on installing a pure (no X11) wayland system on Arch Linux. This is from source and installed into /usr/local. May break your system. You have been warned. (by elethiomel@gmail.com)}}
+
Some developers from i3 have [http://www.i3way.org/ sprouted a completely new project] for implementing a shell plugin for Weston to implement the same features and style of i3.
  
First install a base Arch Linux install with base and base-devel. Do not install xorg or any of its libraries
+
=== Pure Wayland ===
  
 +
{{Warning|Some really quick notes on installing a pure (no X11) Wayland system on Arch Linux. This is from source and installed into {{ic|/usr/local}}. May break your system. You have been warned.}}
  
===== Wayland =====
+
First install a base Arch Linux install with base and base-devel. Do not install xorg or any of its libraries.
  
$ pacman -S libffi
+
===== Wayland, DRM, Pixman, libxkbcommon =====
$ git clone git://anongit.freedesktop.org/wayland/wayland
+
$ cd wayland
+
$ ./autogen.sh --prefix=/usr/local
+
$ make
+
$ make install
+
  
===== DRM and Mesa =====
+
$ pacman -S wayland libdrm pixman libxkbcommon
  
$ git clone git://anongit.freedesktop.org/git/mesa/drm
+
===== Mesa =====
$ cd drm
+
$ ./autogen.sh --prefix=/usr/local
+
$ make
+
$ make install
+
  
 +
$ sudo pacman -S python2 libxml2 llvm
 
  $ git clone git://anongit.freedesktop.org/mesa/mesa
 
  $ git clone git://anongit.freedesktop.org/mesa/mesa
 
  $ cd mesa
 
  $ cd mesa
 
  $ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local --enable-gles2 --disable-gallium-egl --with-egl-platforms=wayland,drm --enable-gbm --enable-shared-glapi --with-gallium-drivers=r300,r600,swrast,nouveau --disable-glx --disable-xlib
 
  $ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local --enable-gles2 --disable-gallium-egl --with-egl-platforms=wayland,drm --enable-gbm --enable-shared-glapi --with-gallium-drivers=r300,r600,swrast,nouveau --disable-glx --disable-xlib
 
  $ make
 
  $ make
  $ make install
+
  $ sudo make install
  
===== xorg-macros =====
 
 
$ git clone http://anongit.freedesktop.org/git/xorg/util/macros.git
 
$ cd macros/
 
$ ./autogen.sh --prefix=/usr/local/
 
$ make
 
$ make install
 
 
===== libxkbcommon =====
 
 
$ git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git
 
$ cd libxkbcommon/
 
$ export ACLOCAL_PATH=/usr/local/share/aclocal/
 
$ ./autogen.sh --prefix=/usr/local/ --with-xkb-config-root=/usr/local/share/X11/xkb
 
$ make
 
$ make install
 
 
===== pixman =====
 
 
$ git clone git://anongit.freedesktop.org/pixman
 
$ cd pixman/
 
$ ./autogen.sh --prefix=/usr/local/
 
$ make
 
$ make install
 
 
 
 
===== cairo =====
 
===== cairo =====
  
Line 159: Line 212:
 
  $ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local/  --disable-xcb  --enable-glesv2  
 
  $ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local/  --disable-xcb  --enable-glesv2  
 
  $ make
 
  $ make
  $ make install
+
  $ sudo make install
 
+
===== xkb files =====
+
 
+
Either
+
 
+
a) Copy from an existing system a set of xkb layouts
+
 
+
$ scp -r /usr/share/X11/xkb to /usr/local/share/X11/
+
 
+
or
+
 
+
b) build  {{ic|xkeyboard-config}} from git with {{ic|--prefix&#61;/usr/local}} and {{ic|--disable-runtime-deps}}
+
  
 
===== weston =====
 
===== weston =====
 
+
$ sudo pacman -S gegl mtdev
 +
''(choose mesa-gl from options for libgl)''
 
  $ git clone git://anongit.freedesktop.org/wayland/weston
 
  $ git clone git://anongit.freedesktop.org/wayland/weston
 
  $ cd weston/
 
  $ cd weston/
  $ CFLAGS="-I/usr/local/include/libdrm/ -DMESA_EGL_NO_X11_HEADERS" ./autogen.sh --prefix=/usr/local/ --with-cairo-glesv2 --disable-xwayland --disable-x11-compositor --disable- xwayland-test
+
  $ CFLAGS="-DMESA_EGL_NO_X11_HEADERS" ./autogen.sh --prefix=/usr/local/ --with-cairo-glesv2 --disable-xwayland --disable-x11-compositor --disable-xwayland-test
 
  $ make
 
  $ make
  $ make install
+
  $ sudo make install
  
==See also==
+
== See also ==
 
* [[Cursor Themes]]
 
* [[Cursor Themes]]
 
==External links==
 
 
* [https://bbs.archlinux.org/viewtopic.php?id=107499 Arch Linux forum discussion]
 
* [https://bbs.archlinux.org/viewtopic.php?id=107499 Arch Linux forum discussion]
 
* [http://wayland.freedesktop.org/docs/html/ Wayland documentation online]
 
* [http://wayland.freedesktop.org/docs/html/ Wayland documentation online]

Revision as of 10:23, 21 October 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end Wayland is a new windowing protocol for Linux. Utilization of Wayland requires changes to and re-installation of parts of your system's software. For more information on Wayland see its homepage.

Warning: Wayland is under heavy development. Support can not be guaranteed and it may not function as you expect.

Requirements

Currently Wayland will only work with on a system that is utilizing KMS.

Installation

Wayland is most probably installed on your system already as it is an indirect dependency of gtk2 and gtk3. If it is not installed, you will find the wayland package in the official repositories.

Usage

As Wayland is only a library, it is useless on its own. To use it, you need a compositor (like Weston), Weston demo applications, Qt5 with Wayland plugin, and/or GTK+ with Wayland support.

Weston

Installation

You need to install weston from the official repositories.

Usage

Keyboard shortcuts (super = windows key) Ctrl-b
Cmd Action
Ctrl + Alt + Backspace Quit weston
Super + Scroll / PageUpDown Zoom into desktop
Super + Tab Switch windows

Now that Wayland and its requirements are installed you should be ready to test it out. Try switching to a terminal and running:

$ weston-launch
Note:
  • You need to be in the video group for Weston to start; this command is not supposed to be run as root and doing that may freeze your VT.
  • 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

It is possible to run Weston inside a running X session:

$ weston

Then at a TTY you can run the demos. To launch a terminal emulator:

$ weston-terminal

To move flowers around the screen:

$ weston-flower 

To test the frame protocol (runs glxgears):

$ weston-gears

To display images:

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

To display PDF Files:

$ weston-view doc1.pdf doc2.pdf...

Configuration

Example configuration file for keyboard layout, module selection and UI modifications:

~/.config/weston.ini
[keyboard]
keymap_layout=en

[shell]
type=desktop-shell.so
background-image=/path/to/your/wallpaper.jpg
background-color=0xff002244
panel-color=0x90ff0000
locking=true
animation=zoom
binding-modifier=ctrl
num-workspaces=6

#type=tablet-shell.so
#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

[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

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

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

#[output]
#name=VGA1
#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
#transform=flipped

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

XWayland

If you plan to run X-applications that don't support Wayland, you have to install xorg-server-xwayland-gitAUR and either patched graphic drivers according to your system, e.g. xf86-video-intel-xwayland-gitAUR, or the generic wlglamor fallback found at xf86-video-wlglamor-gitAUR. After that, create or modify following configuration file:

~/.config/weston.ini
[core]
modules=xwayland.so,desktop-shell.so

Now you can also run X applications in some kind of "compatibility mode".

GUI libraries

(See details on the official website)

GTK+

You need to install gtk3 from the official repositories, which now has the Wayland backend enabled.

With GTK+ 3.0, GTK+ gained support for multiple backends at runtime and can switch between backends in the same way Qt can with lighthouse.

When both Wayland and X backends are enabled, GTK+ will default to the X11 backend, but this can be overridden by modifying an environment variable: GDK_BACKEND=wayland.

Qt5

You need to install qt5-base and the wayland plugin qtwayland-gitAUR.

To run a Qt5 app with the Wayland plugin, set QT_QPA_PLATFORM=wayland-egl.

Clutter

The Clutter toolkit has a Wayland backend that allows it to run as a Wayland client. The backend is enabled in the official package in extra.

To run a Clutter app on Wayland, set CLUTTER_BACKEND=wayland.

SDL

Benjamin Franzke is working on a port of SDL to Wayland, it's available in his sdl-wayland repo on freedesktop.org. Further development upon Benjamins work was done by Andre Heider in his wayland branch of libsdl. Scott Moreau picked up where others left and fixed the library to work with 1.0 protocol. You can find his work in wayland branch of SDL repository.

To run a SDL application on Wayland, set SDL_VIDEODRIVER=wayland.

EFL

EFL has complete Wayland support. To run a EFL application on Wayland, see Wayland project page.

Window managers and desktop shells

KDE

KDE 4.11 beta supports starting KWin under Wayland system compositor. There is currently no support for using KWin as a session compositor.

GNOME

Since version 3.10, Gnome has experimental Wayland support but you have to install xwayland-gitAUR and a equivalent patched graphics driver, e.g. xf86-video-intel-xwayland-gitAUR to get Mutter to work. For details look into the GNOME wiki.

gnome-session --session=gnome-wayland

i3

Some developers from i3 have sprouted a completely new project for implementing a shell plugin for Weston to implement the same features and style of i3.

Pure Wayland

Warning: Some really quick notes on installing a pure (no X11) Wayland system on Arch Linux. This is from source and installed into /usr/local. May break your system. You have been warned.

First install a base Arch Linux install with base and base-devel. Do not install xorg or any of its libraries.

Wayland, DRM, Pixman, libxkbcommon
$ pacman -S wayland libdrm pixman libxkbcommon
Mesa
$ sudo pacman -S python2 libxml2 llvm
$ git clone git://anongit.freedesktop.org/mesa/mesa
$ cd mesa
$ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local --enable-gles2 --disable-gallium-egl --with-egl-platforms=wayland,drm --enable-gbm --enable-shared-glapi --with-gallium-drivers=r300,r600,swrast,nouveau --disable-glx --disable-xlib
$ make
$ sudo make install
cairo

Note - no glx/gl or xcb - EGL only.

$ pacman -S libpng
$ git clone git://anongit.freedesktop.org/cairo
$ cd cairo
$ CFLAGS=-DMESA_EGL_NO_X11_HEADERS ./autogen.sh --prefix=/usr/local/  --disable-xcb  --enable-glesv2 
$ make
$ sudo make install
weston
$ sudo pacman -S gegl mtdev
(choose mesa-gl from options for libgl)
$ git clone git://anongit.freedesktop.org/wayland/weston
$ cd weston/
$ CFLAGS="-DMESA_EGL_NO_X11_HEADERS" ./autogen.sh --prefix=/usr/local/ --with-cairo-glesv2 --disable-xwayland --disable-x11-compositor --disable-xwayland-test
$ make
$ sudo make install

See also