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

@ -163,7 +163,7 @@
]
},
{
"description": "Moves a workspace to a different output.\n\n- Example 1:\n\n ```toml\n [shortcuts]\n alt-F1 = { type = \"move-to-output\", workspace = \"1\", output.name = \"right\" }\n ```\n\n- Example 2:\n\n ```toml\n [shortcuts]\n alt-F1 = { type = \"move-to-output\", output.name = \"right\" }\n ```\n",
"description": "Moves a workspace to a different output.\n\n- Example 1: Move a specific workspace to a named output\n\n ```toml\n [shortcuts]\n alt-F1 = { type = \"move-to-output\", workspace = \"1\", output.name = \"right\" }\n ```\n\n- Example 2: Move the current workspace to a named output\n\n ```toml\n [shortcuts]\n alt-F1 = { type = \"move-to-output\", output.name = \"right\" }\n ```\n\n- Example 3: Move the current workspace to the output on the right (directional)\n\n ```toml\n [shortcuts]\n \"logo+ctrl+shift+Right\" = { type = \"move-to-output\", direction = \"right\" }\n \"logo+ctrl+shift+Left\" = { type = \"move-to-output\", direction = \"left\" }\n \"logo+ctrl+shift+Up\" = { type = \"move-to-output\", direction = \"up\" }\n \"logo+ctrl+shift+Down\" = { type = \"move-to-output\", direction = \"down\" }\n ```\n",
"type": "object",
"properties": {
"type": {
@ -174,13 +174,16 @@
"description": "The name of the workspace.\n\nIf this is omitted, the currently active workspace is moved.\n"
},
"output": {
"description": "The output to move to.\n\nIf multiple outputs match, the workspace is moved to the first matching\noutput.\n",
"description": "The output to move to.\n\nIf multiple outputs match, the workspace is moved to the first matching\noutput.\n\nEither `output` or `direction` must be specified, but not both.\n",
"$ref": "#/$defs/OutputMatch"
},
"direction": {
"description": "The direction to search for the next output.\n\nFinds the closest output in the specified direction based on\ncenter-to-center distance, with preference for outputs better aligned\nwith the movement axis.\n\nEither `output` or `direction` must be specified, but not both.\n",
"$ref": "#/$defs/Direction"
}
},
"required": [
"type",
"output"
"type"
]
},
{
@ -1126,6 +1129,16 @@
}
]
},
"Direction": {
"type": "string",
"description": "A directional value used for output selection.\n",
"enum": [
"left",
"right",
"up",
"down"
]
},
"DrmDevice": {
"description": "Describes configuration to apply to a DRM device (graphics card).\n\n- Example: To disable direct scanout on a device:\n\n ```toml\n [[drm-devices]]\n match = { pci-vendor = 0x1002, pci-model = 0x73ff }\n direct-scanout = false\n ```\n",
"type": "object",

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`

View file

@ -288,19 +288,29 @@ Action:
description: |
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" }
```
fields:
workspace:
description: |
@ -315,8 +325,21 @@ Action:
If multiple outputs match, the workspace is moved to the first matching
output.
required: true
Either `output` or `direction` must be specified, but not both.
required: false
ref: OutputMatch
direction:
description: |
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.
required: false
ref: Direction
configure-connector:
description: |
Applies a configuration to connectors.
@ -4193,6 +4216,21 @@ BlendSpace:
description: Linear color space. This is the physically correct blend space.
Direction:
kind: string
description: |
A directional value used for output selection.
values:
- value: left
description: The left direction.
- value: right
description: The right direction.
- value: up
description: The up direction.
- value: down
description: The down direction.
ClientCapabilities:
description: |
A mask of client capabilities.