river-layout: create and implement protocol

Replace the current layout mechanism based on passing args to a child
process and parsing it's stdout with a new wayland protocol. This much
more robust and allows for more featureful layout generators.

Co-authored-by: Isaac Freund <ifreund@ifreund.xyz>
This commit is contained in:
Leon Henrik Plickat
2020-10-02 15:53:08 +02:00
committed by Isaac Freund
parent df3e993013
commit f72656b72e
26 changed files with 1261 additions and 653 deletions

View File

@ -1,86 +0,0 @@
RIVER-LAYOUTS(7) "github.com/ifreund/river"
# NAME
river-layouts - Details on layout generators for river
# DESCRIPTION
River can use external window management layouts. To get such a layout, river
will run an executable and parse its output. This document outlines how such a
layout generator interacts with river.
# INPUT
When running the executable, river will provide it with five parameters which
are appended to the end of the command in the following order:
. The amount of visible clients (integer)
. The amount of views dedicated as main (integer)
. The screen size multiplier for the main area (float between 0.0 and 1.0)
. The useable width of the output (integer)
. The useable height of the output (integer)
A layout generator may choose to ignore any of these values except
for the first one.
# OUTPUT
River expects four integer values for each window: The x position, the y
position, the width and the height. These must be separated by spaces. A window
configuration having fewer or more than four values is an error and will cause
river to fall back the full layout.
A layout generator needs to output position and size for every visible window.
The window configurations are separated by a newline. Too few or too many
outputted window configurations is an error and will cause river to fall back
to the full layout.
River will apply the position and dimensions in the order they are outputted to
the visible windows in the stack from top to bottom.
The output of a layout generator is not required to remain the same when called
with identical parameters. Layouts are allowed to also depend on external
factors or be completely random.
# WINDOW DIMENSIONS and POSITION
Layout generators are not supposed to include padding or leave space for window
borders. The window dimensions will be shrunk by river to make space for these.
River enforces a minimal window width and height of 50.
Layout generators operate on a special coordinate grid from 0 to the maximum
useable width or height of an output with the coordinate 0-0 being positioned
at the top-left corner of the useable area of an output. While layout
generators are free to place windows everywhere (including coordinates below
zero or above the maximum width or height of an output), beware that the
relative positioning of this grid on the screen can not be expected to remain
constant. River applies an offset to window positions, depending on outer
padding and the presence of desktop widgets like bars. Layout generators can
therefore not position windows at exact screen coordinates.
Layout generators are not required to make use of the entire available space.
Windows may overlap.
# EXAMPLE
Below is an example output of a layout generator for four visible windows. In
this example layout all four windows have a size of 500 by 500 and are arranged
in a grid.
```
0 0 500 500
500 0 500 500
0 500 500 500
500 500 500 500
```
# AUTHORS
Maintained by Isaac Freund <ifreund@ifreund.xyz> who is assisted by open
source contributors. For more information about river's development, see
<https://github.com/ifreund/river>.
# SEE ALSO
*river*(1), *riverctl*(1), *rivertile*(1)

View File

@ -38,29 +38,6 @@ over the Wayland protocol.
*focus-view* *next*|*previous*
Focus the next or previous view in the stack.
*layout* *full*|_command_
Provide a command which river will use for generating the layout
of non-floating windows on the currently focused output. See
*river-layouts*(7) for details on the expected formatting of the
output of layout commands. Alternatively, “full” can be given
instead of a command to cause river to use its single internal layout,
in which windows span the entire width and height of the output.
*mod-main-count* _integer_
Increase or decrease the number of "main" views which is relayed to the
layout generator. _integer_ can be positive or negative. Exactly how
"main" views are display, or if they are even displayed differently
from other views, is left to the layout generator.
*mod-main-factor* _float_
Increase or decrease the "main factor" relayed to layout
generators. _float_ is a positive or negative floating point number
(such as 0.05). This value is added to the current main factor which
is then clamped to the range [0.0, 1.0]. The layout generator is
free to interpret this value as it sees fit, or ignore it entirely.
*rivertile*(1) uses this to determine what percentage of the screen
the "main" area will occupy.
*move* *up*|*down*|*left*|*right* _delta_
Move the focused view in the specified direction by _delta_ logical
pixels. The view will be set to floating.
@ -264,16 +241,10 @@ A complete list may be found in _/usr/include/linux/input-event-codes.h_
Setting _step-size_ to 1.0 disables transitions fully regardless of
the value of _delta-t_.
*outer-padding* _pixels_
Set the padding around the edge of the screen to _pixels_.
*set-repeat* _rate_ _delay_
Set the keyboard repeat rate to _rate_ key repeats per second and
repeat delay to _delay_ milliseconds.
*view-padding* _pixels_
Set the padding around the edge of each view to _pixels_.
*xcursor-theme* _theme_name_ [_size_]
Set the xcursor theme to _theme_name_ and optionally set the _size_.
The theme of the default seat determines the default for Xwayland
@ -309,6 +280,28 @@ River declares certain default options for all outputs.
Changing this option changes the title of the wayland and X11 backend
outputs.
*layout* (string)
The layout namespace used to determine which layout should arrange this
output. If set to null or no layout with this namespace exists for this
output, the output will enter floating mode. Defaults to null.
*main_amount* (uint, optional hint for layouts)
An arbitrary positive integer indicating the amount of main views. Defaults
to 1.
*main_factor* (float, optional hint for layouts)
A floating point numger indicating the relative size of the area reserved
for main views. Note that layouts commonly expect values between 0.1 and 0.9.
Defaults to 0.6.
*view_padding* (uint, optional hint for layouts)
A positive integer indicating the padding in of pixels between / around
views. Defaults to 10.
*outer_padding* (uint, optional hint for layouts)
A positive integer indicating the padding in of pixels around the layut.
Defaults to 10.
# EXAMPLES
Bind bemenu-run to Super+P in normal mode:
@ -325,4 +318,4 @@ source contributors. For more information about river's development, see
# SEE ALSO
*river*(1), *river-layouts*(7), *rivertile*(1)
*river*(1), *rivertile*(1)

View File

@ -6,32 +6,19 @@ rivertile - Tiled layout generator for river
# SYNOPSIS
*rivertile* *left*|*right*|*top*|*bottom* [args passed by river]
*rivertile*
# DESCRIPTION
*rivertile* is a layout generator for river. It produces tiled layouts with
split main/secondary stacks in four configurable orientations.
*rivertile* is a layout client for river. It provides four tiled layouts per
output with split main/secondary stacks with the main area in different
positions.
# OPTIONS
The namespaces of the four layouts are "tile-top", "tile-right", "tile-bottom"
and "tile-left", corresponding to the position of the main area.
*left*
Place the main stack on the left side of the output.
*right*
Place the main stack on the right side of the output.
*top*
Place the main stack at the top of the output.
*bottom*
Place the main stack at the bottom of the output.
# EXAMPLE
Set river's layout to *rivertile*'s *left* layout using riverctl
riverctl layout rivertile left
*rivertile* uses the *main_amount*, *main_factor*, *view_padding* and
*outer_padding* options.
# AUTHORS
@ -41,4 +28,5 @@ source contributors. For more information about river's development, see
# SEE ALSO
*river-layouts*(7), *river*(1), *riverctl*(1)
*river*(1), *riverctl*(1)