Skip to content

Headless: add a readiness signal and let cui png --wait use it #6

Closed

Description

@albertwoo

Context

Any app whose first frames are empty must block startup so cui png / CUISHARP_HEADLESS captures real content. In my dashboard:

if (Environment.GetEnvironmentVariable("CUISHARP_HEADLESS") is "1" or "true")
    tracker.WaitForFirst(TimeSpan.FromSeconds(25));   // otherwise the PNG is an empty shell

That arbitrary sleep is wall-clock tax on every screenshot and CI run, and every data-driven app will reinvent it.

Proposal

  • A first-class signal: ui.MarkReady() on the frame that may be considered settled, or CuiAppOptions.Ready = () => bool.
  • HeadlessLoop records it. cui png --wait ready blocks until it appears (with a timeout), and --wait-text "Updated 12:34" covers apps that do not opt in.
  • Keep --frames for the existing behaviour.

Acceptance

cui png out.png --wait ready returns as soon as live data lands, with no app-level sleep, and fails with a clear timeout message otherwise.

Activity

  1. albertwoo commented on Nov 11, 2026

    @albertwoo
    ContributorAuthor

    Fixed and merged in PR #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions