Skip to content

view --output fails when the Simulator window isn't visible #1

Description

@webcoyote

iosef view has two code paths that produce differently-sized images and have different window-visibility requirements:

Invocation Capture source Output size Limitations
view (no --output) IOSurface framebuffer (via captureSimulator) iOS points (1 px = 1 point) -
view --output <path> CGWindowListCreateImage (via captureToFile) window pixels (Retina ~3×) window must be visible

So the same command prints differently-sized images depending on whether --output is passed, and --output silently fails when the Simulator window is hidden. This type of problem occurs for CI build servers and for my own project, sandvault, where I do iOS automation from within a sandbox to hidden iOS Simulator windows.

Proposed fix

Two new subcommands that capture via the framebuffer in both no-output and file modes, so they work regardless of window state:

  • iosef snap-points — 1 px = 1 iOS point (coordinate-aligned with tap / describe), matches the contract view's base64 path already provides
  • iosef snap-pixels — native device pixel resolution, for OCR and visual diffing

Both accept --output and --type png|jpeg|tiff|bmp|gif, exposed over MCP as snap_points / snap_pixels. view is kept unchanged for backward compatibility.

Internally this shares a captureFramebufferCGImage helper (IOSurface → simctl fallback), so the existing view base64 fast path doesn't regress.

PR

I've put together a draft PR for this at webcoyote#1 — this repo's settings restrict PRs to collaborators, so I can't open it here directly. Happy to rework the approach if you'd prefer a different shape (e.g. keeping to one command with a --framebuffer flag, or making the new behavior the default for view --output).

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions