Skip to main content

Module kdeclient

Module kdeclient 

Source
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 name on the compositor at socket_path, holding it open until remove_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 no kde_output_device_v2 globals.
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_path serves zkde_screencast_unstable_v1 at the version carrying stream_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 no kde_output_management_v2.