Make output layout configrable
Weston only has a hardcoded policy on laying out outputs to form a desktop. This needs to be configrable. A proposal:
weston.ini could use a new section:
All the other keys in the section would depend on the value of the
type key. The
type key should at least implement values
horizontalmeans a linear layout where all enabled outputs are arranged in a row in the given order. By default they are aligned by top edge.
verticalmeans a linear layout where all enabled outputs are arranged in a column in the given order. By default they are aligned by left edge.
The order for both
vertical is given by multiple
order keys. Each
order key in
layout section attempts to match an enabled output. The ordering of matched outputs is given by the order of the
order keys in the section, from left to right or from top to bottom. It there are enabled outputs that are not matched by any
order key, those are added to the end in arbitrary order after all matched outputs have been placed. If an
order key matches multiple enabled outputs, to be decided. If the default alignment by top/left edge is not sufficient, it is possible to add another key to define the alignment.
At first, the
order key shall recognize only one match criterion:
output=<output name>. More criteria can be defined later, e.g.
serial=<monitor-serial> and so on. Multiple criteria on the same
order key must be allowed and they are separated by a comma (
A complete example for the DRM backend:
[layout] type=horizontal order=output=DP-1 order=output=DVI-D-1
This should result in a fixed layout where, if enabled, the
DP-1 output is on the left (the first in the ordering) and the
DVI-D-1 output is on the right (second in the ordering).
The idea of the above scheme is to allow implementing simple layout rules easily while leaving it possible to add more complex rules later. Other possible types of laying things out are:
- The Xorg style of output A right-of output B etc. while allowing complex two-dimensional setups and being totally dynamic: if an output listed in the configuration is not enabled, the algorithm still needs to compute the remaining output positions such that it results in a single topologically connected group of outputs.
- A strict matching type, where if all enabled outputs match a predefined pattern (resolutions included), then that pattern provides absolute positions in x,y for each output.