Skip to main content

Module session

Module session 

Source
Expand description

The versioned session.json schema.

Coordinates are stored twice per selection: px (monitor-local physical pixels — the authoritative space everything is drawn and cropped in) and global_px (derived: monitor origin + local). Per-monitor scale lets consumers reconstruct logical points; the schema does not pretend there is a universal logical space.

Re-exports§

pub use crate::geometry::MAX_COORD;

Structs§

AppInfo
LineRecord
A measure’s two endpoints, flat rather than nested, so a consumer reads ax instead of a.x for a thing that is always exactly two points.
MeasureRecord
One measurement, with its derived values precomputed so a consumer never re-derives geometry to read a number off a ruler.
MonitorRecord
SelectionRecord
SessionFile
TargetRecord
The --target window as it stood at the instant of the freeze.

Enums§

CaptureKind
How the session’s frames were obtained. Optional in the schema — sessions written before it existed simply lack it.
MonitorMatch
How a saved MonitorRecord resolved against the displays attached now. Both non-Missing variants carry an index into the candidate slice that was searched.
SessionError
Why a session file is not usable, even though it parsed.

Constants§

APP_NAME
MAX_LABEL_LEN
The longest label a selection or measure may carry — a ceiling derived from filenames, not a number anyone picked.
SCHEMA_VERSION

Functions§

distinct_labels
The labels a --label could have matched, in session order, deduplicated ASCII case-insensitively; unlabeled selections contribute nothing.
match_monitor
Resolve a session’s monitor against the live enumeration by identity — name, size and scale — rather than by enumeration index.
restore_measures
The measures a saved session carries, back as editable rulers.
restore_selections
Rebuild editable selections from a saved session — the inverse of SessionFile::build. Shapes come back in monitor-local px; rects reclaim their rot_deg metadata, triangles keep rotation baked in their vertices (their records never carry rot_deg), and circles are rotation-free. Feed the result to SelectionSet::seed.
select_by_label
The selections a --label restricts to, paired with their index in the session — the identity every report row carries. None selects everything. Matching is ASCII case-insensitive, as the window matcher is.