glass_wait_stable
Wait until a window settles (stops changing), then return the settled frame. Optionally restrict the settle check to a sub-region, or omit the image for a text-only result.
Instructions
Wait until the window stops changing, then return the settled frame. Optional stability_region watches only that sub-rectangle for settling (ignore unrelated motion); optional region crops the returned frame. Set include_image: false for a text-only {settled,width,height} result with no image (region ignored) — cheap before a text glass_diff.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ignore | No | Window-relative rectangles to exclude from the settle comparison. Use for perpetually animating content — a blinking text caret, a clock, a spinner — which otherwise keeps the window from ever settling. Pixels inside a rect never count as changed and never set `saw_motion`. Combines with `stability_region`: rects are always window-relative and are intersected with it. Independent of `region`, which only crops the returned image. A rect that falls partially or entirely outside the compared area — the frame, or the `stability_region` sub-rectangle when one is set — is silently clamped or dropped, masking less than requested or nothing at all; the excluded count is reported as `ignored_pixels`, so a smaller-than-expected value flags a misplaced rect. | |
| region | No | Optional window-relative sub-rectangle for the returned frame. | |
| tolerance | No | Per-channel difference (0–255) two frames may have and still count as unchanged (default 0, exact match). Raise it for a backend with dithering or compression noise. | |
| window_id | No | Capture/observe this window (id from `glass_list_windows`) instead of the active one, without changing which window subsequent ops target. Omit for the active window. | |
| timeout_ms | No | Give up after this long (default 5000ms); returns `{settled:false}` rather than erroring. | |
| interval_ms | No | How long to wait between capture ticks (default 100ms). | |
| include_image | No | Return the settled frame as an image (default true). Set false for a text-only `{settled, saw_motion, observed_ms, ignored_pixels, width, height}` result with no WebP — cheap when the next step is a text `glass_diff`. `region` is ignored when false. | |
| settle_frames | No | Consecutive unchanged frames required before the UI counts as settled (default 3). Raise it for an app that pauses mid-animation. | |
| stability_region | No | Optional window-relative sub-rectangle to watch for settling; when set, the settle decision ignores changes outside it. Independent of `region`. |