Add protocol for making windows magnetic to each other
A seen practice is to make two separate toplevel windows "magnetic" (a main window and a set of dialogs), meaning that when they are placed exactly next to each other, moving the main window makes the dialog move along, while moving the dialog would detach it.
There is currently no way to achieve this under Wayland.
A rough idea of a potential way of thinking of and solving the use case:
There are two problems that needs solutions, mapping of the dialog, and attaching metadata that it should be magnetic.
The metadata could likely just be anything between a boolean on the window, and a specific "magnet group" on each edge, depending on how much granularity is needed.
The placement could potentially make use of xdg_positioner
, with the "anchor rect" always being the window geometry of the window one wants to place relative to.
Perhaps there needs to be state
about what side is "magnetized" too.
Practically, it could be a xdg_wm_magnet_v1
that extends xdg_shell
's xdg_toplevel
with this additional functionality via e.g. a xdg_magnet_window_v1
.