JSON output and exit codes
Machine-readable output and the exit codes the glimmer command returns, for scripts and CI.
JSON#
Add --json (or -j) to any command. Success is one JSON object on standard output; an error is one JSON object on standard error. watch prints one object per line.
{
"schemaVersion": 1,
"ok": true,
"command": "capture",
"result": {
"format": "png", "byteCount": 401233, "pixelWidth": 2560, "pixelHeight": 1600, "scale": 2,
"target": { "kind": "window", "matchCount": 2 },
"redaction": { "status": "applied", "regions": 1 },
"notices": [], "library": null
},
"output": { "path": "/Users/you/safari.png" }
}
{
"schemaVersion": 1,
"ok": false,
"command": "capture",
"error": {
"code": "no-match.window", "message": "No window matches bundle ID com.example.none.",
"hint": "Run `glimmer windows` to see what can be captured.",
"exitCode": 4, "exitName": "no-match", "retryable": false
}
}
--json can’t be combined with image bytes on standard output; use -o FILE.
What’s in result#
| Command | Fields |
|---|---|
capture, card | format, byteCount, pixelWidth, pixelHeight, scale, target, redaction, notices, library |
ocr, grab-text | text, lines[] (text, confidence, bounds), codes[], level, languages, target, redaction |
windows | a list of index, id, bundleID, app, title, frame, layer, onScreen, captureProtected |
displays | a list of index, id, uuid, name, frame, scale, pixelWidth, pixelHeight, primary, rotation |
destinations | wherry (ready, not-installed, needs-consent…), destinations[] (id, name, kind, available) |
upload | uploadID, destination, remoteKey, link, verified |
pipelines, run | the workflow list; for run: name, status, outputs[] |
diff | changedPixels, comparedPixels, changedPercent, thresholdPercent, exceeded, width, height, sizeMismatch, hasDiffImage, baseline, candidate |
watch (per line) | event: sequence, timestamp, changedPercent, changedRect, captureID |
version | cli (version, protocol, jsonSchema), app, appError |
Keys are camelCase and dates are ISO 8601. Within a schema version, fields are never removed, renamed or retyped; new ones may appear, so ignore keys you don’t know.
Exit codes#
Exit codes never change meaning.
| Code | Name | Meaning |
|---|---|---|
| 0 | success | |
| 1 | failure | Anything not listed below |
| 2 | usage | Bad arguments, a terminal where a pipe is needed, unreadable input |
| 3 | permission-denied | Glimmer lacks Screen Recording or Accessibility, or you declined this client |
| 4 | no-match | No window, display, destination or workflow matches |
| 5 | cancelled | You cancelled (Esc in the overlay, Cancel in a confirmation) |
| 6 | timeout | --timeout passed |
| 7 | diff-exceeded | diff changed more than --threshold |
| 8 | upload-failed | The upload failed or its link couldn’t be checked |
| 9 | no-gui-session | No logged-in session with a screen (SSH, launchd daemon, headless CI), or the screen is locked |
| 10 | version-mismatch | The command and the app are different versions; the message says which to update |
| 11 | app-unavailable | Glimmer isn’t installed, isn’t running with --no-launch, or didn’t start in time |
| 12 | busy | Glimmer is in the middle of another capture or recording |
| 13 | no-text | No text found (see --allow-empty) |
| 14 | redaction-required | Something needs a person to review it before these pixels can leave |
| 15 | unavailable | Not available in this version, or not set up |
| 16 | capture-failed | The capture produced nothing (a protected or vanished window, a blank frame) |
| 17 | storage | Saving failed (disk full, folder missing, -o not writable) |
| 130 | interrupted | Ctrl-C |
| 143 | terminated | SIGTERM |
Next#
Something missing or unclear? Write to [email protected].