1
0
Fork 0
forked from wry/wry

feat(config): Add directional output selection via separate direction field

Add support for directional output selection in the move-to-output action
using a separate `direction` field instead of overloading OutputMatch.

API additions:
- Add Workspace::connector() to get the connector showing a workspace
- Add Connector::connector_in_direction() to find outputs directionally

Implementation:
- Move directional finding logic from toml-config to compositor
- Algorithm uses center-to-center distance with axis-aligned preference
- Add GetWorkspaceConnector and GetConnectorInDirection IPC messages

Configuration changes:
- Add optional `direction` field to move-to-output action
- Either `output` or `direction` must be specified (not both)
- Valid directions: "left", "right", "up", "down"

Example usage:
  logo+control+shift+right = { type = "move-to-output", direction = "right" }

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Arthur Heymans 2025-11-27 09:49:33 +01:00 committed by Julian Orth
parent e81b31b452
commit 5529306c67
13 changed files with 348 additions and 25 deletions

View file

@ -290,19 +290,29 @@ This table is a tagged union. The variant is determined by the `type` field. It
Moves a workspace to a different output.
- Example 1:
- Example 1: Move a specific workspace to a named output
```toml
[shortcuts]
alt-F1 = { type = "move-to-output", workspace = "1", output.name = "right" }
```
- Example 2:
- Example 2: Move the current workspace to a named output
```toml
[shortcuts]
alt-F1 = { type = "move-to-output", output.name = "right" }
```
- Example 3: Move the current workspace to the output on the right (directional)
```toml
[shortcuts]
"logo+ctrl+shift+Right" = { type = "move-to-output", direction = "right" }
"logo+ctrl+shift+Left" = { type = "move-to-output", direction = "left" }
"logo+ctrl+shift+Up" = { type = "move-to-output", direction = "up" }
"logo+ctrl+shift+Down" = { type = "move-to-output", direction = "down" }
```
The table has the following fields:
@ -314,15 +324,29 @@ This table is a tagged union. The variant is determined by the `type` field. It
The value of this field should be a string.
- `output` (required):
- `output` (optional):
The output to move to.
If multiple outputs match, the workspace is moved to the first matching
output.
Either `output` or `direction` must be specified, but not both.
The value of this field should be a [OutputMatch](#types-OutputMatch).
- `direction` (optional):
The direction to search for the next output.
Finds the closest output in the specified direction based on
center-to-center distance, with preference for outputs better aligned
with the movement axis.
Either `output` or `direction` must be specified, but not both.
The value of this field should be a [Direction](#types-Direction).
- `configure-connector`:
Applies a configuration to connectors.
@ -2285,6 +2309,33 @@ An array of masks that are OR'd.
Each element of this array should be a [ContentTypeMask](#types-ContentTypeMask).
<a name="types-Direction"></a>
### `Direction`
A directional value used for output selection.
Values of this type should be strings.
The string should have one of the following values:
- `left`:
The left direction.
- `right`:
The right direction.
- `up`:
The up direction.
- `down`:
The down direction.
<a name="types-DrmDevice"></a>
### `DrmDevice`