Expand description
KDE client growing, removing, and arranging a nested KWin session’s screens. KDE session-screen client: grows, removes, and arranges the screens of a nested KWin session, in-process.
KWin serves no control socket; its interface for a screen that exists on
demand is zkde_screencast_unstable_v1. A stream_virtual_output request
creates a real output carrying the requested name, and that output lives
exactly as long as the stream object: KWin removes it when the stream is
closed or its client disconnects, and only then. A failed event is the
PipeWire stream’s failure, not the screen’s — the output is created before
the stream starts — so no PipeWire consumer is required and frames keep
arriving through the host window the nested output opens, which also
drives the screen’s size ([add_screen] only seeds it). Each grown screen
therefore parks one open connection in a process-wide registry; nothing
dispatches it afterwards, because holding the socket open is the entire
contract, and [remove_screen] closes the stream to give the screen back.
A session is offered a second display on this rung when the compositor
serves the request ([screen_control_offered], a registry read that
touches no screen); whether it registers the screen it grows is proven
when a display asks for one, since a KWin whose nested backend registers
no virtual output serves the request all the same: [grow] confirms the
screen against the output devices and refuses the display with that
reason.
Arrangement rides kde_output_management_v2 over the per-output
kde_output_device_v2 globals. Unlike zwlr_output_management_v1 there
is no state serial and a configuration is a delta — a device left out
keeps its state — and modes come from the advertised list only, never
custom, so [set_screen_layout] positions screens and leaves their size
to the capture side; their scale is not set here either, because a nested
KWin accepts one and ignores it, following the host window’s preferred
fractional scale instead. Screens are addressed by position in name order,
matching outclient. Blocking, off the compositor thread, with every
round-trip deadline-bounded.
Functions§
- add_
screen - Grow a screen named
nameon the compositor atsocket_path, holding it open untilremove_screen. Idempotent for a name already held. - list_
screens - The session’s enabled screens as
(name, x, y, width, height)in screen order; the size is the current mode’s,(0, 0)where none was announced. Empty when the compositor serves nokde_output_device_v2globals. - remove_
screen - Close the held stream behind the screen
name, removing it — the compositor’s own output-destroy path evacuates its windows. False when no such screen is held (one the session booted with, or another process’s). - screen_
control_ offered - Whether the compositor on
socket_pathserveszkde_screencast_unstable_v1at the version carryingstream_virtual_output: the rung a session with no control socket is offered a second display on. A registry read alone, so a session is asked on every landing without a screen coming or going on it; whether a grown screen registers is [grow]’s to prove. Err only when the compositor is unreachable. - set_
screen_ layout - Position the session’s screens at
rects, one(x, y, width, height)per screen in screen order; sizes are validated but not applied, because a nested KWin screen’s size follows its host window. The rectangles are capture pixels and the positions land in the session’s logical space, closed up around each screen’s scale (outclient::close_gaps). Returns how many were positioned; 0 when the compositor serves nokde_output_management_v2.