Skip to main content

set_screen_layout

Function set_screen_layout 

Source
pub fn set_screen_layout(
    socket_path: &str,
    rects: Vec<(i32, i32, i32, i32)>,
) -> Result<usize, String>
Expand description

Lay the session’s screens out at rects, one (x, y, width, height) per screen in screen order, so its own layout matches the arrangement the capture outputs were placed in.

A session compositor arranges the screens it opens by its own rule — wlroots puts them side by side in the order they appear — and that layout, not the capture one, is what places windows and carries the pointer between screens. Every screen is positioned in one configuration: applied one at a time, an intermediate state overlaps two screens and the compositor reflows around it. The rectangles are capture pixels; the positions land in the session’s logical space, where a scaled screen is its mode over its scale, closed up so a screen beside a scaled one meets its logical edge rather than its pixel edge.

Returns how many screens were positioned; 0 when the compositor manages no outputs for clients, which is where a session on KWin lands (it offers kde_output_management_v2 instead) and where the arrangement stays whatever that compositor chose.