Add CycleInRegion action

CycleInRegion will cycle focus between all windows/views that are within
the given region, to support position-based focusing.

The window/region matching supports:
* when a window is explicitly assigned to a region
* an optional `windowOverlapPercentage` arg, when at least the given
  percentage of the window's geometry is within the region's geometry.
* an optional `regionOverlapPercentage` arg, when at least the given
  percentage of the region's geometry is within the window's geometry.

To support immediate focus cycling and to avoid ping-pong'ing between the
top two windows, we cycle through windows within a region in
reverse-order.  When we are not focused within a region, we instead focus
the top-most (first) window, as that is what the user will expect.

If the `region` arg is not specified, the action will cycle through all
windows on the given desktop instead.
This commit is contained in:
Robert M. Thomson 2024-05-22 07:43:57 +02:00
parent 16c5373be5
commit 6a4d937050
4 changed files with 225 additions and 1 deletions

View file

@ -125,6 +125,23 @@ Actions are used in menus and keyboard/mouse bindings.
Resize and move the active window back to its untiled or unmaximized
position if it had been maximized or tiled to a direction or region.
*<action name="CycleInRegion" region="value" windowOverlapPercent="value" regionOverlapPercent="value" />*
Cycle focus to the next window in the given region.
If _windowOverlapPercent_ is set and > 0, it is the minimum percentage of
the window area that must lie inside the region.
If _regionOverlapPercent_ is set and > 0, it is the minimum percentage of
the region area that must lie inside the window.
If both are omitted or set to 0, a window matches only if it is explicitly
assigned to the region (e.g. tiled to it), regardless of window size.
If _region_ is omitted, cycle focus to the next window on the entire
screen (still honoring the standard window-switcher criteria such as
current-workspace filtering).
See labwc-config(5) for further information on how to define regions.
*<action name="NextWindow" workspace="current" output="all" identifier="all" />*++
*<action name="PreviousWindow" workspace="current" output="all" identifier="all" />*
Cycle focus to next/previous window, respectively.