Skip to main content

Crate blit_remote

Crate blit_remote 

Source

Structs§

CallbackRenderer
CellStyle
Dom
FrameState
PtyListEntry
Rect
SearchResultEntry
SurfaceListEntry
TerminalState

Enums§

Color
Node
ServerMsg

Constants§

AUDIO_FRAME_CODEC_MASK
AUDIO_FRAME_CODEC_OPUS
C2S_ACK
C2S_AUDIO_SUBSCRIBE
Subscribe to audio: [0x30][bitrate_kbps:2] Audio is per-compositor (one mixed stream), not per-surface. The server begins sending S2C_AUDIO_FRAME. bitrate_kbps: 0 = server default.
C2S_AUDIO_UNSUBSCRIBE
Unsubscribe from audio: [0x31]
C2S_CLIENT_FEATURES
Client feature/capability advertisement: [0x2D][payload:N] Currently defined payload bytes: [0] codec_support — bitmask of CODEC_SUPPORT_* flags the client can decode. 0 = accept anything (legacy). Sent once after connection when capability probing completes. The message is extensible: the server ignores trailing bytes it doesn’t understand, and missing bytes default to 0.
C2S_CLIENT_METRICS
C2S_CLIPBOARD_GET
Read clipboard content for a specific MIME type: [0x2E][mime_len:2][mime:N] Server responds with S2C_CLIPBOARD_CONTENT (0x25) containing the data.
C2S_CLIPBOARD_LIST
Request a list of MIME types available on the clipboard: [0x2C] Server responds with S2C_CLIPBOARD_LIST.
C2S_CLIPBOARD_SET
Set clipboard content: [0x25][mime_len:2][mime:N][data_len:4][data:N]
C2S_CLOSE
C2S_COPY_RANGE
Copy text from a range of absolute row/col positions in scrollback + viewport: [0x1B][nonce:2][pty_id:2][start_tail:4][start_col:2][end_tail:4][end_col:2][flags:1] start_tail/end_tail: physical row distance from the bottom (0 = last row). start is the earlier position (closer to top), so start_tail >= end_tail. flags: reserved (0 for now). Server responds with S2C_TEXT using the same nonce.
C2S_CREATE
C2S_CREATE2
Generic create: [0x18][nonce:2][rows:2][cols:2][features:1][tag_len:2][tag:N][…optional fields] Features: bit 0 = has src_pty_id (2 bytes after tag), bit 1 = has command (remaining bytes after src_pty_id if present) Server responds with S2C_CREATED_N using the same nonce.
C2S_CREATE_AT
C2S_CREATE_N
C2S_DISPLAY_RATE
C2S_FOCUS
C2S_INPUT
C2S_KILL
Send a signal to a PTY’s session leader: [0x1A][pty_id:2][signal:4] signal is a raw libc signal number (e.g. SIGTERM=15, SIGKILL=9).
C2S_MOUSE
Mouse event: [0x06][pty_id:2][type:1][button:1][col:2][row:2] type: 0=down, 1=up, 2=move button: 0=left, 1=mid, 2=right, 3=release, 64=wheel_up, 65=wheel_down The server generates the correct escape sequence based on mouse_mode and mouse_encoding.
C2S_PING
Application-level keepalive: [0x08]. No payload. Sent periodically by the client; the server treats it as a no-op (but its arrival resets any server-side receive timeout).
C2S_QUIT
Request server shutdown: [0x0F]. No payload. The server broadcasts S2C_QUIT to all connected clients and exits.
C2S_READ
Read text from a PTY’s scrollback + viewport: [0x19][nonce:2][pty_id:2][offset:4][limit:4][flags:1] offset: number of lines to skip from the top (oldest = 0), or from the end if READ_TAIL is set limit: max lines to return (0 = all) flags: bit 0 = include ANSI styling, bit 1 = offset counts from the end Server responds with S2C_TEXT using the same nonce.
C2S_RESIZE
Desired viewport size(s): [0x01][pty_id:2][rows:2][cols:2]… Clients may batch multiple PTY resize entries in one message. The server mediates these per-client desired sizes into each PTY’s effective size. A rows, cols pair of 0, 0 clears this client’s desired size for that PTY.
C2S_RESTART
Restart an exited PTY: [0x07][pty_id:2] Server spawns a new shell in the same PTY slot, preserving the pty_id.
C2S_SCROLL
C2S_SEARCH
C2S_SUBSCRIBE
C2S_SURFACE_ACK
Acknowledge receipt of a surface video frame: [0x2A]
C2S_SURFACE_CAPTURE
Request a screenshot of a surface: [0x27][surface_id:2] — legacy (defaults to PNG lossless) [0x27][surface_id:2][format:1][quality:1] — extended format: 0 = PNG, 1 = AVIF. quality: 0 = lossless, 1–100 = lossy (AVIF only).
C2S_SURFACE_CLOSE
Request close of a Wayland surface (sends xdg_toplevel close event): [0x2B][surface_id:2]
C2S_SURFACE_FOCUS
Set keyboard/pointer focus to a Wayland surface: [0x24][surface_id:2]
C2S_SURFACE_INPUT
Keyboard input for a Wayland surface: [0x20][surface_id:2][data:N] data contains evdev keycodes encoded as [keycode:4][pressed:1] sequences.
C2S_SURFACE_LIST
Request a list of all compositor surfaces: [0x26]
C2S_SURFACE_POINTER
Pointer motion/button for a Wayland surface: [0x21][surface_id:2][type:1][button:1][x:2][y:2] type: 0=down, 1=up, 2=move x,y: pixel coordinates relative to the surface origin
C2S_SURFACE_POINTER_AXIS
Pointer axis/scroll for a Wayland surface: [0x22][surface_id:2][axis:1][value_x100:4_signed] axis: 0=vertical, 1=horizontal value_x100: scroll amount * 100 (signed, positive = down/right)
C2S_SURFACE_RESIZE
Resize a Wayland surface: [0x23][surface_id:2][width:2][height:2][scale_120:2] scale_120: device pixel ratio in 1/120th units (120 = 1×, 240 = 2×).
C2S_SURFACE_SUBSCRIBE
Subscribe to surface frame updates: [0x28][surface_id:2] — legacy (server defaults) [0x28][surface_id:2][codec:1][quality:1] — extended [0x28][surface_id:2][codec:1][quality:1][width:2][height:2] — scaled
C2S_SURFACE_TEXT
Composed text input for a Wayland surface (UTF-8): [0x2F][surface_id:2][text:N] The server synthesises the corresponding evdev key sequences (US-QWERTY) for ASCII characters. Non-ASCII characters are delivered via zwp_text_input_v3 commit_string when available.
C2S_SURFACE_UNSUBSCRIBE
Unsubscribe from surface frame updates: [0x29][surface_id:2]
C2S_UNSUBSCRIBE
CAPTURE_FORMAT_AVIF
CAPTURE_FORMAT_PNG
CELL_SIZE
CODEC_SUPPORT_AV1
CODEC_SUPPORT_AV1_444
CODEC_SUPPORT_H264
Bitmask for client-supported codecs in C2S_CLIENT_FEATURES and C2S_SURFACE_SUBSCRIBE. 0 means “accept anything”.
CODEC_SUPPORT_H264_444
CREATE2_HAS_COMMAND
CREATE2_HAS_SRC_PTY
EXIT_STATUS_UNKNOWN
FEATURE_AUDIO
FEATURE_COMPOSITOR
FEATURE_COPY_RANGE
FEATURE_CREATE_NONCE
FEATURE_RESIZE_BATCH
FEATURE_RESTART
READ_ANSI
READ_TAIL
ROW_FLAG_WRAPPED
Per-row flag: this row’s content continues on the next row (line wrap).
S2C_AUDIO_FRAME
An encoded audio frame (Opus) from the compositor’s mixed output: [0x30][timestamp:4][flags:1][data:N] timestamp: sample offset in 48 kHz ticks from an arbitrary epoch. flags: bits 1-2 = codec (0 = Opus). Other bits reserved.
S2C_CLIPBOARD_CONTENT
Clipboard content (response to C2S_CLIPBOARD_GET or unsolicited broadcast on change): [0x25][mime_len:2][mime:N][data_len:4][data:N]
S2C_CLIPBOARD_LIST
List of MIME types available on the clipboard: [0x2C][count:2] repeated{ [mime_len:2][mime:N] }
S2C_CLOSED
S2C_CREATED
S2C_CREATED_N
S2C_EXITED
The PTY’s subprocess has exited but the terminal state is retained. Clients can still read/scroll the last frame. Send C2S_CLOSE to dismiss. Wire: [0x08][pty_id:2][exit_status:4] exit_status: WEXITSTATUS if normal exit, negative signal number if signalled, EXIT_STATUS_UNKNOWN if not yet collected.
S2C_HELLO
S2C_LIST
S2C_PING
Application-level keepalive: [0x0B]. No payload. Sent periodically by the server so clients can detect dead connections even when no other traffic is flowing (e.g. idle terminal, WebRTC).
S2C_QUIT
Server is shutting down: [0x0C]. No payload. Broadcast to all connected clients before the server exits.
S2C_READY
Sent after the initial burst (HELLO, LIST, TITLE*, EXITED*) is complete. Clients can use this to know when the initial state has been fully transmitted.
S2C_SEARCH_RESULTS
S2C_SURFACE_APP_ID
A Wayland surface’s app_id changed: [0x28][surface_id:2][app_id:N]
S2C_SURFACE_CAPTURE
Screenshot of a surface: [0x27][surface_id:2][width:4][height:4][image_data:N] image_data is PNG or AVIF depending on the request format. If the surface was not found or has no buffer, width=0 and height=0 with empty data.
S2C_SURFACE_CREATED
A new Wayland toplevel surface was created: [0x20][surface_id:2][parent_id:2][width:2][height:2][title_len:2][title:N][app_id_len:2][app_id:N] parent_id: 0 = no parent (top-level), non-zero = dialog/child of that surface
S2C_SURFACE_CURSOR
Cursor shape changed for a surface: [0x29][surface_id:2][shape_len:1][shape:N] shape is a CSS cursor keyword (e.g. “default”, “pointer”, “text”).
S2C_SURFACE_DESTROYED
A Wayland surface was destroyed: [0x21][surface_id:2]
S2C_SURFACE_ENCODER
Encoder backend for a surface: [0x2A][surface_id:2][name:N] name is a short ASCII string like “h264-nvenc”, “h264-vaapi”, “h264-software”, etc. Sent when a new encoder is created for a surface (initial subscribe or resize).
S2C_SURFACE_FRAME
An encoded video frame for a Wayland surface: [0x22][surface_id:2][timestamp:4][flags:1][width:2][height:2][data:N] flags: bit 0 = keyframe, bits 1-2 = codec (0 = H.264, 1 = AV1). timestamp: milliseconds since compositor session start.
S2C_SURFACE_LIST
List of all compositor surfaces: [0x26][count:2] repeated{ [surface_id:2][parent_id:2][width:2][height:2][title_len:2][title:N][app_id_len:2][app_id:N] }
S2C_SURFACE_RESIZED
A Wayland surface was resized by the app: [0x24][surface_id:2][width:2][height:2]
S2C_SURFACE_TITLE
A Wayland surface’s title changed: [0x23][surface_id:2][title:N]
S2C_TEXT
Text response: [0x0A][nonce:2][pty_id:2][total_lines:4][offset:4][text:N] nonce: echoed from C2S_READ request total_lines: total available lines (scrollback + viewport rows) offset: the offset that was requested text: UTF-8 text, lines separated by \n
S2C_TITLE
S2C_UPDATE
SURFACE_FRAME_CODEC_AV1
SURFACE_FRAME_CODEC_H264
SURFACE_FRAME_CODEC_MASK
SURFACE_FRAME_CODEC_PNG
SURFACE_FRAME_FLAG_KEYFRAME
SURFACE_QUALITY_DEFAULT
Quality values for the quality byte in C2S_SURFACE_SUBSCRIBE. 0 means “use server default” (from BLIT_SURFACE_QUALITY env var).
SURFACE_QUALITY_HIGH
SURFACE_QUALITY_LOW
SURFACE_QUALITY_MEDIUM
SURFACE_QUALITY_ULTRA

Functions§

build_update_msg
msg_ack
msg_c2s_clipboard_get
Build a C2S_CLIPBOARD_GET message (request clipboard content for a specific MIME type).
msg_c2s_clipboard_list
Build a C2S_CLIPBOARD_LIST message (request available MIME types).
msg_c2s_clipboard_set
msg_client_metrics
msg_close
msg_copy_range
msg_create
msg_create2
msg_create_at
Spawn a new PTY in the same working directory as src_pty_id.
msg_create_command
msg_create_n
msg_create_n_command
msg_create_tagged
msg_create_tagged_command
msg_display_rate
msg_exited
msg_focus
msg_hello
msg_input
msg_kill
msg_quit
Build a C2S_QUIT message (client requests server shutdown).
msg_read
msg_resize
msg_resize_batch
msg_restart
msg_s2c_clipboard_content
msg_s2c_clipboard_list
Build an S2C_CLIPBOARD_LIST message (response with available MIME types).
msg_s2c_quit
Build an S2C_QUIT message (server notifies clients of shutdown).
msg_scroll
msg_search
msg_subscribe
msg_surface_app_id
msg_surface_close
msg_surface_created
msg_surface_destroyed
msg_surface_encoder
Build S2C_SURFACE_ENCODER: [0x2A][surface_id:2][name\0codec_string]. The codec_string is the WebCodecs codec string (e.g. “av01.2.05M.08”) appended after a NUL separator. Old clients that don’t split on NUL will just display the full string as the encoder name, which is fine.
msg_surface_focus
msg_surface_frame
msg_surface_input
msg_surface_pointer
msg_surface_pointer_axis
msg_surface_resize
scale_120 is the device-pixel-ratio in 1/120th units, matching Wayland’s fractional_scale_v1 convention: 120 = 1×, 180 = 1.5×, 240 = 2×. A value of 0 means “unspecified” (server defaults to 1×).
msg_surface_resized
msg_surface_subscribe
msg_surface_subscribe_ext
Extended surface subscribe with per-surface codec and quality overrides.
msg_surface_subscribe_scaled
Scaled surface subscribe: ask the server to encode this surface at exactly width × height for this client, bypassing surface-size mediation. Intended for side-panel thumbnails and any viewer that wants a fixed-size stream independent of the compositor’s native surface size and of other clients’ view sizes.
msg_surface_title
msg_surface_unsubscribe
msg_unsubscribe
parse_server_msg