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

@ -1385,6 +1385,31 @@ impl ConfigClient {
workspaces
}
/// Returns the connector that the workspace is currently on.
/// Returns `Connector(0)` (invalid connector) if the workspace doesn't exist or
/// isn't assigned to any connector.
pub fn get_workspace_connector(&self, workspace: Workspace) -> Connector {
let res = self.send_with_response(&ClientMessage::GetWorkspaceConnector { workspace });
get_response!(res, Connector(0), GetWorkspaceConnector { connector });
connector
}
/// Finds the connector in the specified direction from the given connector.
/// Returns `Connector(0)` (invalid connector) if no connector exists in that direction
/// or if the source connector is invalid.
pub fn get_connector_in_direction(
&self,
connector: Connector,
direction: Direction,
) -> Connector {
let res = self.send_with_response(&ClientMessage::GetConnectorInDirection {
connector,
direction,
});
get_response!(res, Connector(0), GetConnectorInDirection { connector });
connector
}
pub fn set_client_matcher_capabilities(
&self,
matcher: ClientMatcher,

View file

@ -805,6 +805,13 @@ pub enum ClientMessage<'a> {
show: bool,
},
GetShowTitles,
GetWorkspaceConnector {
workspace: Workspace,
},
GetConnectorInDirection {
connector: Connector,
direction: Direction,
},
}
#[derive(Serialize, Deserialize, Debug)]
@ -1043,6 +1050,12 @@ pub enum Response {
GetShowTitles {
show: bool,
},
GetWorkspaceConnector {
connector: Connector,
},
GetConnectorInDirection {
connector: Connector,
},
}
#[derive(Serialize, Deserialize, Debug)]