Wayland

From ArchWiki
Revision as of 16:29, 29 July 2014 by AnAkkk (Talk | contribs) (Update information about xwayland)

Jump to: navigation, search

Related articles

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 on systems 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 - can be changed, see weston.ini) Ctrl-b
Cmd Action
Ctrl + Alt + Backspace Quit Weston
Super + Scroll (or PageUp/PageDown) Zoom in/out of desktop
Super + Tab Switch windows
Super + LMB Move Window
Super + MMB Resize Window
Super + RMB Rotate Window !
Super + K Force Kill Active Window
Super + KeyUp/KeyDown Switch Prev/Next Workspace
Super + Shift + KeyUp/KeyDown Grab Current Window and Switch Workspace
Super + Fn Switch to Workspace n
Super + S Take a screenshot
Super + R Record a screencast.

Now that Wayland and its requirements are installed you should be ready to test it out.

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

$ weston

Alternatively, to launch Weston natively, try switching to a terminal and running:

$ weston-launch

Then at a TTY within Weston, 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. See man weston.ini for full details:

~/.config/weston.ini
[core]
### uncomment this line for xwayland support ###
#modules=desktop-shell.so,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

Minimal weston.ini :

~/.config/weston.ini
[core]
modules=desktop-shell.so,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

You can find an official xorg-server-xwayland package in extra.

When you want to run an X application from within Weston, it spins up Xwayland to service the request.

Note:

Weston 1.4 or older doesn't support the new Xwayland. Neither does GNOME 3.12.

If you plan to run native X-applications inside Wayland, create or modify following configuration file:

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

Now you can also run X applications in weston.

If you want to run GNOME 3.12 on wayland, some hack is needed you may and refer to this guide.

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 either rebuild qt5-base with -opengl es2 (currently not working, see http://lists.qt-project.org/pipermail/development/2013-December/014789.html ) or use qt5-base-gitAUR. Then build the wayland plugin qt5-wayland-gitAUR.

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

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

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

Version 3.1 will have wayland support through a compile flag that you have to enable. In the mean time you can install the package from the AUR glfw3-gitAUR and add -DGLFW_USE_WAYLAND=ON to the cmake flags

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

With version 3.12 Gnome has experimental Wayland support but you have to install xorg-server-xwayland. You also have to install a mutter-wayland snapshot that makes use of the new Xwayland DDX. Use these two files to rebuild the package with makepkg.

PKGBUILD

mutter-wayland.install

With any open source driver you can now start "Gnome on Wayland" from GDM as a special session.

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.

Hawaii

See the article on Hawaii

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

Troubleshooting

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

See also