glass_wait_stable
Wait for the UI to settle until consecutive frames stop changing, then return the final stable frame. Use a stability region to focus on specific content and ignore moving elements.
Instructions
Wait for visual quiescence: consecutive frames stop changing, then return the last frame. This proves stability, not that an expected semantic state or pixel design was reached; use glass_wait_for_element for a semantic condition/value or glass_wait_for_region with a baseline for expected pixels. Optional stability_region watches only that sub-rectangle; optional region crops the returned frame. Set include_image:false for text-only metadata. If at least two next actions or waits are known, use glass_do instead of separate calls.
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`. |