Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Summary
Add a bettercapture command-line tool so scripts and AI agents can control BetterCapture: list capture targets, start and stop recordings without the system picker, and get the saved file's path back as JSON.
The running app acts as the server. The CLI is a thin client that sends commands over a Unix socket. The app keeps owning the Screen Recording permission, the active recording, settings, and the recording indicators. Commands from the CLI and from the menu bar act on the same RecorderViewModel.
Commands (v1)
bettercapture status [--json]
bettercapture displays | windows | apps [--json]
bettercapture record [TARGET] [overrides] [--duration 30s] [--wait] [--output PATH] [--json]
TARGET: --display main|ID|N --window ID|"title" --app BUNDLE_ID|name
--area x,y,w,h [--display …] --pick
overrides (this recording only): --codec --fps --container --[no-]mic
--[no-]system-audio --[no-]cursor
bettercapture stop [--copy] [--json]
bettercapture pause | resume
bettercapture wait [--json]
bettercapture skill show
bettercapture version
--jsonon every command, with stable field names and full IDs.- The output path is chosen when recording starts and is returned by
record --json. - Ctrl-C during
record --waitstops and saves the recording. - Options passed to
recordapply to that recording only. They don't change saved settings. - Only one recording at a time.
recordwhile recording exits 1. - Targets are matched by full ID, then name (case-insensitive), then position. An ambiguous match stops without doing anything.
- If the app isn't running, the CLI launches it and waits for the socket.
Exit codes: 0 ok, 1 failure, 2 bad usage, 3 target not found or ambiguous, 4 app not reachable, 5 permission missing or CLI control disabled, 130 interrupted.
App changes
- Remove the App Sandbox. Migrate existing settings, including the output folder bookmark, from the container preferences to
~/Library/Preferenceson first launch. Drop entitlements that are no longer needed. - Socket server at
~/Library/Application Support/BetterCapture/control.sock, with permissions0600. The protocol is newline-delimited JSON and every message carries a protocol version. - "Allow command-line control" setting, off by default. Headless target selection lets any local process use BetterCapture's Screen Recording permission, so the user has to opt in. The usual recording indicators still show.
- Headless content selection. Build
SCContentFilters for displays, windows, apps and areas fromSCShareableContent, extendingContentFilterService.
Installation
- The CLI ships at
BetterCapture.app/Contents/Helpers/bettercapture.Contents/MacOS/BetterCapturewould clash with it because macOS file names ignore case by default. - Homebrew: add a
binaryline to the cask. - DMG: on every launch the app creates or repairs
~/.local/bin/bettercapture. It never overwrites a file that isn't a link into a BetterCapture.app. - Settings → Command Line shows whether the command is reachable on the user's login shell PATH. If it isn't, Settings shows the PATH line to add. The app doesn't edit dotfiles.
bettercapture skill showprints a guide for agents, including the full-path fallback.
Dependencies
swift-argument-parser, linked into the CLI target only.
Out of scope for v1
settings get/seteventsstream
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
refactor(app): remove app sandbox
feat(cli): add control socket server to the app
feat(cli): add bettercapture command-line tool
fix(cli): link the tool in debug builds too
refactor(app): remove app sandbox
feat(cli): add control socket server to the app
feat(cli): add bettercapture command-line tool
fix(cli): link the tool in debug builds too