Implement key binds to control virtual outputs

It is now possible to use keybinds to add and remove virtual outputs
(also called headless backend in wlroots terminology).
This commit is contained in:
kyak 2023-12-05 19:06:56 +03:00
parent 5d2f594626
commit 45012d322a
5 changed files with 149 additions and 1 deletions

View file

@ -180,6 +180,46 @@ Actions are used in menus and keyboard/mouse bindings.
*wrap* [yes|no] Wrap around from last desktop to first, and vice
versa. Default yes.
*<action name="VirtualOutputAdd" output_name="value" />*
Add virtual output (headless backend).
Virtual outputs is a useful mechanism. For example, it can be used to overlay
virtual output on real output, but with a different resolution (this can be
done with `wlr-randr` or `wdisplays`). After that, virtual output can be
selected for screen sharing (casting), effectively sharing only the region of
the screen.
It must be noted that overlaying virtual output and real output is not
endorsed or explicitely supported by wlroots. For example, after configuring
virtual output, real output must be reconfigured as well (for the overlay
configuration to work correctly). This is the example configuration:
```
<keybind key="W-v">
<action name="VirtualOutputAdd" output_name="ScreenCasting"/>
<action name="Execute" command='sh -c "wlr-randr --output ScreenCasting --pos 0,0 --scale 2 --custom-mode 3840x2110; wlr-randr --output eDP-1 --pos 0,0 --scale 2 --mode 3840x2160"'/>
</keybind>
<keybind key="W-c">
<action name="VirtualOutputRemove"/>
</keybind>
```
Note that the vertical resolution of "ScreenCasting" output is just 50px
smaller than "eDP-1" output to cut off bottom panel from screen sharing.
This setup is also useful for extending the desktop to (maybe mobile) remote
systems like tablets. E.g. simply adding a virtual output, attaching wayvnc to
it and running a VNC client on the remote system.
*output_name* The name of virtual output. Providing virtual output name is
beneficial for further automation. Default is "HEADLESS-X".
*<action name="VirtualOutputRemove" output_name="value" />*
Remove virtual output (headless backend).
*output_name* The name of virtual output. If not supplied, will remove first
found virtual output.
*<action name="None" />*
If used as the only action for a binding: clear an earlier defined binding.