How to Run Wayland and Weston on Arch Linux

Hello, today we are going to talk about the new windowing protocol for the Linux operating system, its name is Wayland, it is maintained by the people at freedesktop.org, which also helps on X development. The main motivation in creating a new windowing protocol is that X became complex, legacy technology and concepts turned it hard to make it better. Wayland was designed with a new, simpler architecture that performs better and makes it easier to develop.

Wayland Weston desktop

Wayland Weston desktop

Wayland is still in development and will not replace X as the main windowing system anytime soon. the fact is that X is a mature system, it simply works and is expected to be found on Linux/unix systems, so, even when Wayland become the main windowing system for unices they should have X as legacy option.

Despite Wayland is under development you can give try it right now and that is what we are going to do now.

Installing Wayland and Weston packages

Here is how to install the required packages to run Wayland and its reference compositor, Weston.

First you should update your system

pacman -Syu

Now install wayland, which will also install libxml if it is not present.

pacman -S wayland

Then install Weston, a compositor, window manager on which Wayland clients (applications) run.

pacman -S weston

During the installation, pacman will ask you to select which package will provide libgl, this will depend on your video card. Following image shows the options.

Select libgl provider

Select libgl provider

Here is a list of other dependencies that will be installed on a brand new Arch Linux setup.

Weston package dependency

Weston package dependency

Running Weston

You can run weston on different ways, directly as the main backend or from within another windowing system.

Running within X
You can run weston from within X by calling weston from a xterm session.

weston

As with X, you can start a weston instance within another, once again just call weston. The following image shows a stack of Weston running within Weston within Weston within X.

X->Weston->Weston->Weston stack

X->Weston->Weston->Weston stack

Running without X

Now lets try to run weston as our main backend. From one of system's VT call weston launcher.

weston-launch

Configure Weston

As you should have seen, you can run weston without any extra configuration, however you can set some things to customize and make it better.

weston.ini

To configure weston you should create/change the weston.ini file, which is usually at ~/.config/weston.ini. Here i will show some options you could use to do such changes.

The core section is used to select the startup compositor modules and general options.

[core] backend=drm-backend.so

The keyboard section is used to select keyboard options, such as layout and variant.

[keyboard] keymap_layout=fr
keymap_model=pc105
keymap_variant=euro
keymap_options=grp:alt_shift_toggle

At the shell section you will set some of the behaviour and visual aspects of the compositor.

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

The screensaver section let you set the path to screensaver and its timeout.

[screensaver] path=/usr/libexec/weston-screensaver
duration=600

At output section you set how things will be displayed on the monitor, the following are commonly used ones. Note also the different uses of the mode options, the mode options are like on xorg.conf.

#[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

To add items to the panel, you should create an launcher section containing the path to the executable and an icon.

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

These were some of the main options, which should be enough to test weston, for more details you should take a look at weston.ini(1). Anyway here is a complete weston.ini example with some other settings.

[core] backend=drm-backend.so

[keyboard] keymap_layout=us
#keymap_model=pc105
#keymap_variant=euro
keymap_options=grp:alt_shift_toggle

[shell] type=desktop-shell.so
background-image=/usr/share/archlinux/wallpaper/archlinux-aftermath.jpg
background-type=scale
#background-color=0xff00ff00
panel-color=0x55227700
locking=true
animation=zoom
binding-modifier=ctrl
num-workspaces=4
cursor-size=16

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

[screensaver] path=/usr/lib/weston/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
transform=normal

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

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

[launcher] path=/usr/bin/weston-flower
icon=/usr/share/icons/Adwaita/24x24/emblems/emblem-generic.png

[launcher] path=/usr/bin/weston-editor
icon=/usr/share/icons/Adwaita/24x24/devices/input-dialpad.png

Wayland clients

Along with Wayland and Weston, there are some utilities that will be installed. These are some nice wayland client examples that shows some of the wayland and weston capabilities.

weston-flower - Draw and drag some random flowers on the screen

weston-smoke - Draw smoke that follows the cursor

weston-editor - Very simple text editor example

weston-image - Simple image viewer, just call it with the image path as the first argument

weston-terminal - Simple terminal shell

There are other applications included, but they are not so fun, mostly useful for development/debugging purpose.

Here are some of these Wayland clients running.

Wayland clients

Wayland clients

Conclusion

Well, so this is it, Wayland is working and you can run Weston from within X, directly or from within another Weston session. There are already more native clients and also ways to run X applications on top of Wayland. It is time to take a look, play around and maybe even develop your own Wayland clients.

Have run and thanks for reading!

About Carlos Alberto

Carlos is a technology professional and enthusiast. In his spare time he likes skateboarding and play guitar.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.