Reference

CLI reference

Every command, target, and image option.

Eight commands: five standalone, plus the service and its client. The standalone commands each open a display, do their work, and exit.

CommandPurpose
captureCapture a desktop, region, or window and return it.eensh capture [TARGET] [IMAGE] [OUTPUT]
diffCompare two saved images and report what changed.eensh diff BEFORE AFTER [OPTIONS]
wait-changeBlock until the visible state departs from a baseline.eensh wait-change [TARGET] [OPTIONS]
wait-stableBlock until the visible state stops moving.eensh wait-stable [TARGET] [OPTIONS]
observeWait for a transition, then for it to settle, and return the result.eensh observe [TARGET] [OPTIONS]
serveRun the persistent capture service in the foreground.eensh serve [--socket PATH]
pingAsk a running service whether it is alive.eensh ping [--socket PATH] [--json]
sessionTalk to a running service: create, capture, diff, observe, realtime.eensh session <SUBCOMMAND>

Target options

Shared by every command that captures. All three are optional.

OptionMeaning
--display DISPLAYX11 display, for example `:1`. Overrides `$DISPLAY`.
--region X,Y,W,HA rectangle in source-desktop pixels. Never clipped silently.
--window IDAn X11 window by ID, decimal or `0x`-prefixed. Reads the visible desktop under it.

Image options

OptionMeaning
--format png|jpegOutput format. Defaults to `png`, or is inferred from the output file extension.
--quality NJPEG quality, 1–100. Default `80`. JPEG only.
--compression fast|default|bestPNG effort. Default `default`, which maps to the encoder's *Balanced* level — see the performance page before using it on a large screen.
--width NResize to a width, preserving aspect ratio. Applied before encoding.
--height NResize to a height, preserving aspect ratio.
--scale FResize by a uniform factor.

Output options

OptionMeaning
OUTPUTPositional output path. `-` or omitted means stdout.
--base64Embed the encoded image in the JSON response. Requires `--json`.
--jsonEmit the structured JSON response.
--timePrint per-stage timings to stderr.
bash
eensh capture shot.png                    # PNG to a file
eensh capture --format jpeg shot.jpg      # JPEG to a file
eensh capture --format png - | consumer   # PNG on stdout
eensh capture --base64 --json             # agent-facing JSON on stdout

Observation options

For wait-change, wait-stable, and observe.

OptionMeaning
--mode exact|rgbComparison mode for change detection. Default `rgb`.
--pixel-threshold NLargest per-channel difference treated as unchanged. Default `12`.
--area-threshold FSmallest changed fraction treated as meaningful. Default `0.005`.
--interval DTarget cadence between samples. Default `100ms`.
--timeout DTotal deadline. Default `5s`. A timeout exits `100`, which is not an error.
--stable-for DHow long the scene must hold still. Default `300ms`.

Real-time options

OptionDefaultMeaning
--frames3How many frames, 1–8. A maximum, not a promise.
--interval50msNominal spacing between sample opportunities.
--timeout500msDeadline for starting a capture. Deliberately shorter than the observation default, because a real-time request is bounded by intent.

Presentation flags

Available on capture, latest, frame, diff, and realtime. With none of them supplied, the output is exactly what it was before presentation existed.

OptionMeaning
--overview-width WWhole-frame overview width, preserving aspect ratio.
--overview-format png|jpegOverview format.
--overview-quality NOverview JPEG quality, 1–100.
--no-overviewOmit the whole-frame view, sending only regions.
--metadata-onlyDescribe every view and embed no pixels anywhere.
--region NAME=X,Y,W,HA named source-space region, repeatable. Optional `@SCOPE` and `@!PRIORITY` suffixes.
--region-width WWidth for regions that do not name their own.
--region-format png|jpegFormat for regions that do not name their own.
--temporal MODE`all-same`, `newest-detailed`, `newest-only`, or `metadata-older`.
--older-width WWidth for the older frames of a real-time stack.
--newest-width WWidth for the newest frame of a real-time stack.
--max-base64-bytes BYTESMost base64 bytes the visual payload may occupy. Fitting is opt-in.
--changed-regionCrop to the Phase 2 changed region, for `session diff`.
--changed-padding PIXELSPadding around the changed region, clamped at the source edges. Default `0`.

Session subcommands

SubcommandNotes
session createResolves geometry eagerly, so a bad display fails here rather than on the first capture.
session list / infoRegistry contents and one session’s state.
session captureNew frame, new ID, appended to history.
session latest / frameRetrieval without touching the display.
session diffCompares two retained frames.
session wait-change / wait-stable / observeThe same state machines, running through a session.
session realtimeA bounded temporal stack.
session closeRefused during an observation, with the session intact.

Global flags

FlagMeaning
--socketService socket path. Defaults to $EENSH_SOCKET, then $XDG_RUNTIME_DIR/eensh.sock, then a user-scoped temporary path.
--jsonEmit the structured response. Required on every session command, because those responses are the result.

Every flag above has a corresponding typed field on the Rust client — see the client page.