pub enum ThreadCommand {
Show 33 variants
StartCapture {
display_id: u32,
callback: Option<Py<PyAny>>,
settings: RustCaptureSettings,
},
StopCapture {
display_id: u32,
},
CreateOutput {
id: u32,
width: i32,
height: i32,
x: i32,
y: i32,
scale: f64,
reply: Sender<bool>,
},
DestroyOutput {
id: u32,
reply: Sender<bool>,
},
RepositionOutput {
id: u32,
x: i32,
y: i32,
reply: Sender<bool>,
},
ListOutputs {
reply: Sender<Vec<OutputDesc>>,
},
OutputCapacity {
reply: Sender<i64>,
},
MoveWindowToOutput {
window_id: u32,
output_id: u32,
reply: Sender<bool>,
},
ListWindows {
reply: Sender<Vec<WindowDesc>>,
},
SetCursorCallback(Py<PyAny>),
SetClipboardCallback(Py<PyAny>),
SetClipboard {
mime: String,
data: Vec<u8>,
},
KeyboardKey {
scancode: u32,
state: u32,
},
KeyboardKeys {
events: Vec<(u32, u32)>,
},
SetKeymapString(String),
SetXkbLayout {
rules: String,
model: String,
layout: String,
variant: String,
options: String,
reply: Sender<bool>,
},
BindKeysyms {
keysyms: Vec<u32>,
reply: Sender<Vec<(u32, u32)>>,
},
SetKeymapOverlay {
binds: Vec<(u32, u32)>,
},
GetKeyboardState {
reply: Sender<(Vec<u32>, u32)>,
},
GetXkbKeymap {
reply: Sender<String>,
},
Barrier {
reply: Sender<()>,
},
PointerMotion {
x: f64,
y: f64,
},
PointerRelativeMotion {
dx: f64,
dy: f64,
},
PointerButton {
btn: u32,
state: u32,
},
PointerAxis {
x: f64,
y: f64,
},
UpdateCursorConfig {
render_on_framebuffer: bool,
},
SetCursorSize {
size: i32,
reply: Sender<bool>,
},
RequestIdr {
display_id: u32,
},
UpdateRate {
display_id: u32,
bitrate_kbps: Option<i32>,
vbv_multiplier: Option<f64>,
fps: Option<f64>,
},
UpdateTunables {
display_id: u32,
tunables: LiveTunables,
},
CuScreenshot {
display_id: u32,
resp: Sender<Result<Vec<u8>, String>>,
},
CuCursorPosition {
resp: Sender<(f64, f64)>,
},
CuGetInfo {
display_id: u32,
resp: Sender<(i32, i32, f64)>,
},
}Expand description
Control messages sent from the Python-facing methods to the capture thread.
Every interaction with a running capture crosses the thread boundary as one of these variants over the command channel: starting and stopping, injecting keyboard / pointer input, swapping the xkb keymap, serving the clipboard, changing live rate and per-frame tunables, and the computer-use queries that read back the screen, cursor, and geometry.
Variants§
StartCapture
Start (or in-place reconfigure) the capture bound to output display_id.
callback is the Python per-frame delivery target; None starts an internal
capture with no Python consumer (the built-in recorder taps the delivery layer).
StopCapture
Stop the capture bound to output display_id (other displays keep running).
CreateOutput
Create an additional output: WxH physical pixels at fractional scale, mapped
into the layout at offset (x, y). Replies false when the id is taken/reserved or
the GPU render target cannot be allocated.
DestroyOutput
Destroy a secondary output: its capture ends, its windows relocate to the primary output. Replies false for the primary (id 0) or an unknown id.
RepositionOutput
Remap an existing output (the primary included) to layout offset (x, y): the
Space mapping, the offsets used for absolute input injection and cursor
compositing, and the windows placed on it all follow, and the output is damaged so
the next frames render correctly. Replies false for an unknown id.
ListOutputs
Reply with every live output as (id, x, y, width, height, scale, capturing).
Fields
reply: Sender<Vec<OutputDesc>>OutputCapacity
Reply with how many displays this backend can back with real content: -1 when self-compositing (outputs are created on demand), the host compositor’s output count in host-capture mode.
MoveWindowToOutput
Move the window with the given id onto output output_id (fullscreened there).
ListWindows
Reply with every mapped window as (window_id, title, app_id, output_id).
Fields
reply: Sender<Vec<WindowDesc>>SetCursorCallback(Py<PyAny>)
SetClipboardCallback(Py<PyAny>)
SetClipboard
Server-side clipboard offer: the compositor owns the selection and serves data as
mime (plus text aliases) to pasting clients.
KeyboardKey
KeyboardKeys
A whole ordered run of key events in one message. Typing a paste one event at a time costs a channel send and a calloop wake per event, which competes with the render loop on the same thread; the caller still decides the sequence.
SetKeymapString(String)
Set the seat’s BASE keymap from a full XKB_KEYMAP_FORMAT_TEXT_V1 string. The compositor’s keymap policy rebuilds on top: overlay binds are re-spliced onto the new base (same keycodes) and the combined keymap is applied in one swap.
SetXkbLayout
Set the seat’s BASE layout from RMLVO names (empty strings = xkbcommon defaults);
replies whether compilation succeeded. Overlay binds rebuild on top as for
SetKeymapString.
Fields
BindKeysyms
Resolve keysyms to (keycode, level) against the seat keymap, overlay-binding every
keysym the base cannot produce — ONE keymap swap for the whole batch, and a keycode that
is currently pressed is never recycled. (0, 0) marks an unbindable keysym. Serves
computer-use only; selkies resolves its own keysyms and injects plain keycodes.
SetKeymapOverlay
Bind explicit (keycode, keysym) pairs onto the CURRENT base keymap and deliver it,
in one swap. The caller decides the assignment; this only assembles and applies, so the
base is neither re-sent nor recompiled and its reverse map is not rebuilt. Ordered with
key events on the one command channel, so the keys that need the new binds cannot
overtake it — no reply is awaited, and the caller’s loop is never blocked on the swap.
GetKeyboardState
Debug/verification readback: currently pressed xkb keycodes plus the modifier state bitmask (1 ctrl, 2 shift, 4 alt, 8 logo, 16 caps, 32 num, 64 altgr, 128 level5).
GetXkbKeymap
Reply with the smithay keyboard’s keymap as an XKB_KEYMAP_FORMAT_TEXT_V1 string so a consumer (selkies) can build its reverse keysym map from the IDENTICAL keymap.
Barrier
Ack once every previously queued command has been fully processed (the channel is FIFO). The atexit sweep sends StopCapture + Barrier and waits, so the interpreter never exits while the calloop thread is still mid-teardown (an NVENC/CUDA session drop racing process exit segfaults).
PointerMotion
PointerRelativeMotion
PointerButton
btn is an evdev BTN_ code by contract (e.g. 272 = BTN_LEFT, 273 = BTN_RIGHT,
274 = BTN_MIDDLE, 0x113 = BTN_SIDE / 0x114 = BTN_EXTRA for back/forward) and is passed
straight through to smithay’s pointer.
PointerAxis
UpdateCursorConfig
SetCursorSize
Recreate the cursor theme handles at a new pixel size — the calloop’s compositing
helper (the burned-in cursor) and, through its job channel, the wl-cursor worker’s
(named-cursor PNG delivery). Replies false for a non-positive size.
RequestIdr
On-demand keyframe request (client reconnect / decoder reset) for one display’s capture: forces a send and an IDR even on a static screen.
UpdateRate
Live rate-control change for one display’s capture (parity with the X11 rate_dirty
path). Each field is None when that dimension is unchanged.
UpdateTunables
Live per-frame tunables (quality / paint-over / streaming / cursor) for one display’s capture, mirrored to its readback encode thread — no restart.
CuScreenshot
One-shot PNG of one output’s next rendered frame (0 = primary); an unknown display id replies with an error immediately.
CuCursorPosition
CuGetInfo
Auto Trait Implementations§
impl !RefUnwindSafe for ThreadCommand
impl Freeze for ThreadCommand
impl Send for ThreadCommand
impl Sync for ThreadCommand
impl Unpin for ThreadCommand
impl UnsafeUnpin for ThreadCommand
impl UnwindSafe for ThreadCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more