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:
parent
e81b31b452
commit
5529306c67
13 changed files with 348 additions and 25 deletions
|
|
@ -3,7 +3,7 @@
|
|||
use {
|
||||
crate::{
|
||||
_private::WireMode,
|
||||
PciId, Workspace,
|
||||
Direction, PciId, Workspace,
|
||||
video::connector_type::{
|
||||
CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI, CON_DSI,
|
||||
CON_DVIA, CON_DVID, CON_DVII, CON_EDP, CON_EMBEDDED_WINDOW, CON_HDMIA, CON_HDMIB,
|
||||
|
|
@ -327,6 +327,17 @@ impl Connector {
|
|||
pub fn workspaces(self) -> Vec<Workspace> {
|
||||
get!().get_connector_workspaces(self)
|
||||
}
|
||||
|
||||
/// Find the closest connector in the given direction.
|
||||
///
|
||||
/// Uses center-to-center distance calculation and prefers outputs better aligned
|
||||
/// with the movement axis.
|
||||
///
|
||||
/// If no connector exists in the given direction, returns a connector whose
|
||||
/// `exists()` returns false.
|
||||
pub fn connector_in_direction(self, direction: Direction) -> Connector {
|
||||
get!(Connector(0)).get_connector_in_direction(self, direction)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns all available DRM devices.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue