Skip to main content

Module presence

Module presence 

Modules§

capability
Widgets that publish where their user is (caret, selection) to peers.
frame
The workspace’s presence as state of the frame: the host lends it around the pass every widget gets whether or not it is drawn (crate::widget::Widget::update), so a widget that is not on screen still knows who is here.

Structs§

AgentActionMarker
Geometry and phase of one paint-only agent action marker.
CaretTag
A caret name tag a frame painted: the name, and the tag’s rect in scene coordinates.
ChatBubble
A cursor-chat bubble as a painter draws it.
CursorChats
Everyone’s cursor chat and reactions in one presence store.
EdgeMist
A resolved off-screen wayfinding cue: which edge to paint on, where along that edge the peer projects to, and how far off-screen they are.
Face
One person’s face in a stack.
FaceStack
How a row of faces is sized: the face’s side, how much each overlaps the one before, and how many faces show before the count badge.
InteractionCardPlacement
Geometry of one generic fallback card. Public so app hosts and tests can reserve the same non-overlapping activity rail without copying constants.
LabeledCaret
A peer’s caret to label, and the highest its name chip may reach.
LayerMarks
Where a PresenceLayer paints, on screen and this frame (PresenceLayer::marks), in the layer’s scene coordinates.
ParticipantLabels
The numbers a workspace’s participants are told apart by, resolved once from its roster and read for each label shown. Cheap to rebuild whenever the roster changes.
PeerCursor
PillPlacement
Where a pill ended up; tethered means the caller should draw a line back to its pointer.
PillRequest
PlacedPointer
One placed pointer as the host hands it over.
PresenceCtx
PresenceLayer
The presence a window paints over its widgets, kept from frame to frame so the next frame damages only what changed. Retains draw caches only.
PresenceUser
ReactionFloat
A reaction as a painter draws it.
RemoteCursor
SelectionRange
WidgetPresence
Everything in a PresenceCtx a widget may paint from, as of one frame.

Enums§

MistEdge
Which screen edge a mist band hugs — i.e. the direction an off-screen peer is relative to the viewport.
ParticipantKind
The kind of participant behind a live presence stream. This comes from the authenticated workspace context, never from a display-name convention.
PathSegment
PointerOwner
Which layer paints a peer’s pointer — a screen position, so only one layer may place it correctly (an app painting a desktop coordinate into its own window space is right only at the origin). The compositor owns desktop-scoped pointers, since it alone spans the strip, chrome and gaps between windows continuously; an app owns presence inside its own content (caret, selection, typing swipe), since the compositor has no access to the text.
PointerSpace
The coordinate space a pointer position is measured in.
PresenceKey
RemotePresenceEffect
What a subscriber still has to do after PresenceCtx::apply_remote_presence folds a frame in, beyond the presence stores. A subscriber with no document (the compositor) ignores it.

Constants§

ACTIVE_INTERACTION_EXPIRY
A live phase that has not been restated stops occupying the app surface. The durable Task Center remains the place to diagnose a stalled run.
COMPOSING_LINGER
How long a person stays shown as composing after their last word: a draft under way is said again as they type, so one who stops drops out shortly after, with no message.
CURSOR_CHAT_LINGER
How long a sent message stays beside the pointer before it is gone.
CURSOR_CHAT_MAX_CHARS
Longest message, in characters (the live plane’s own bound).
DIGEST_KEY_FIELD
First path field of a PresenceKey::digest_form key.
FOLLOWED_POINTER_REACH
How far from the pointer its ring reaches, antialiased edge included.
PEER_PALETTE
Every colour a peer can be drawn in:the design language’s twelve presence hues (PRESENCE_HUES, 30° apart) at the dark material’s presence lightness and chroma (OKLCH L 0.74, C 0.14, gamut mapped), as sRGB. Equal lightness and chroma, so no participant looks more important than another; a closed ring rather than a hash over all 360 hues, so two people never land a few degrees apart.
POINTER_EASE_MAX
Longest a peer’s pointer takes to glide to a newly heard position. Peers publish at ~30 Hz, so a moving pointer glides over the gap between its last two samples and arrives as the next is due; this caps the glide after a pause (crate::motion::Follow::GLIDE_MAX).
POINTER_FADE
How long a quiet peer’s pointer takes to fade out, ending at POINTER_IDLE: the standard fade of a stream gone quiet (crate::motion::Follow::FADE). See PresenceCtx::pointer_opacity.
POINTER_IDLE
How long a peer’s pointer stays painted after it was last heard about. Comfortably past the ~1s restate interval a live peer keeps, so this notices a peer gone quiet rather than blinking one whose keepalive was briefly delayed. See PresenceCtx::prune_pointers.
POINTER_NAME_LINGER
How long a still pointer keeps its name beside it. The pointer itself stays until it goes quiet (super::POINTER_IDLE); the name is there to say who is moving, and steps aside once they stop.
TERMINAL_INTERACTION_DWELL
A terminal edge remains perceptible even when an immediate action starts and completes between two rendered frames.
TYPING_FADE
How long a “just typed” highlight lingers, its fade included: the standard trace of a collaborator’s mark (crate::motion::Trace).
TYPING_FADE_STEPS
The highlight fades in this many steps, each a wake deadline (crate::motion::Trace::STEPS).
UNSETTLED_RGB
The face of someone here whose colour the workspace has not settled yet: grey, which the presence palette paints neutral (crate::tokens::colors::PresencePalette::of), never a ring colour they would then change from.

Functions§

assign_peer_colors
Give everyone in a room a colour nobody else in it is wearing.
color_distance
How far apart two colours are, weighted the way an eye weights them (the “redmean” approximation).
contrast_ink
Black or white ink for text on bg, by luma — a fixed white label is unreadable on over half the peer palette (11 of 24 entries under 2:1, palest 1.24:1 against white).
contrast_ink_dim
The quieter ink on a person’s colour (a placeholder, a hint): the contrast_ink at the share a secondary line takes.
draw_peer_cursors
Paint pointers, then tethers, then pills — in that layer order so a later peer’s halo can’t wash over an earlier peer’s name. viewport bounds the pills; positions are assumed already filtered to it.
draw_peer_presence
Paint already-resolved peer cursors in one coordinate space. On-screen peers get moving dots and collision-free name pills; off-screen peers become directional edge mist. This is the compositor-facing sibling of draw_remote_presence, which resolves cursors from a PresenceCtx.
draw_remote_cursors
Paint every entry in presence.remote_cursors as a dot + name pill, for non-shell apps drawing cross-process ghost cursors without reimplementing the geometry. No viewport, so pills are de-overlapped but not clamped — prefer draw_remote_presence, which keeps names on screen.
draw_remote_presence
The one call the app makes each frame to render all cross-process peer presence: on-screen peers get a dot + pill, off-screen peers get an edge mist. viewport is the visible rect in the same (logical) space as cursor positions.
edge_mist_for
Compute the edge-mist cue for target relative to viewport.
hide_names_beside_caret_tags
Leave out the name of each pointer whose name tag would crowd a caret tag with the same name (tags_crowd): one person, one tag, wherever the two tags would sit within a tag height of each other. A pointer’s tag is measured where it goes beside its pointer within viewport, as super::draw_peer_cursors places a lone name. carets are in the pointers’ coordinates. A pointer saying something keeps its bubble.
identity_colour
user_color as a colour: what a face of user_id wears when the workspace has not given them one (Face::colour).
identity_rgb
A presence hue as the identity colour it travels as.
layout_peer_pills
Place one name pill per peer so none overlap and none leaves viewport. Each pill tries the four corners around its pointer, taking the first clear of the viewport and every already-placed pill; only when all four are taken does it slide along the vertical and get marked tethered. Placement order is by position, not arrival, so a peer reconnecting doesn’t reshuffle everyone else’s names.
local_surface_pointer
PresenceKey::surface_pointer for this process’s own surface. The coordinates a winit CursorMoved carries are surface-local, so this is the only representation an app can provide.
local_workspace_key
The scope this process should publish its presence under — the workspace it collaborates in, or None when it has no workspace. Read from local_cluster_id, the same value the routing address is built from, so the two cannot drift apart.
name_key
What two names compare as: case-folded, with runs of whitespace as one space and none at the ends.
paint_follow_frame
The frame round the work while following someone: their colour, a chrome rule either side of area’s edge at the tile radius, as present as the follow is (openness, 0 to 1).
paint_followed_pointer
The ring round the pointer of the person being followed, in their colour; it stays within FOLLOWED_POINTER_REACH of the pointer.
paint_own_chat_bubble
This person’s own cursor-chat bubble while they type, beside their pointer at at: the same bubble everyone else sees, in their colour and under their name, sized for message and at least min_text_w wide, kept inside bounds (left of or above the pointer near an edge). Paints its shape and name and returns the bubble and the one-line rect the caller puts its text field in.
paint_reaction
A reaction rising from a pointer at at; returns where it painted.
paint_speaking_ring
The ring a speaking participant’s tile wears over its picture: their colour, as strong as their voice is now (level, 0 to 1), a chrome rule thick on each side of the tile’s edge.
parse_hex_color
Parse a #rgb / #rrggbb / #rrggbbaa colour string to an RGB triple (see crate::color::parse_hex). Alpha is discarded; None for anything unparseable.
presence_colour
A presence colour as the surfaces paint it: the (r, g, b) a person’s colour travels as (user_color, a colour they chose), in the colour a face or a row is drawn with.
single_emoji
The emoji text is, when it is exactly one (surrounding spaces aside): what makes a cursor-chat message a reaction rather than words. The :name: of an emoji the window’s workspace has is one too.
tag_gap
The gap between two tag rects: zero when they touch or overlap, else the straight distance between their nearest edges.
tags_crowd
Whether a caret tag and a pointer tag of the same person read as one name twice: their gap is within one tag height (the taller of the two), so the eye takes them as one cluster.
user_color
Stable identity colour for a collaborator who has not chosen one: the presence hue PresenceHue::of_identity derives from their id, as the sRGB colour in PEER_PALETTE. A pure function of the id alone: two hosts painting the same room see different peer sets (everyone but themselves), so a colour derived from who’s present couldn’t agree across machines.

Type Aliases§

PointerPositions
A pointer’s last-known (x, y) per user, at each PresenceKey.