Screenshot Capture
Follow these save-location rules every time:
- If the user specifies a path, save there.
- If the user asks for a screenshot without a path, save to the OS default screenshot location.
- If Codex needs a screenshot for its own inspection, save to the temp directory.
Decide the capture scope
Choose the narrowest capture that matches the task.
- Do not change focus, bring another app to the front, or otherwise interrupt the user's current work unless they explicitly ask for that behavior.
- If the user names an app, capture that app with
--app first.
- If the user points at a dialog, settings pane, or titled window, add
--window-name when possible.
- If the app has multiple candidate windows, run
--list-windows first and then retry with --window-id.
- Use
--active-window only when the user explicitly wants the current/frontmost window, or when the app is unknown but they can focus it.
- Use a full-screen capture only when the user explicitly wants the desktop, all monitors, or a composition spanning multiple apps.
- For Codex visual inspection of a desktop app, default to
--app "<App>" --mode temp. Avoid --active-window if Codex, the terminal, or another unrelated app is frontmost.
- If a named macOS app is likely minimized and the user explicitly allows a brief focus change, retry with
--restore-minimized so Codex can restore the app, capture it, then minimize it again and return focus.
This is the main guardrail for avoiding accidental screenshots of the user's working area.
Tool priority
- Prefer tool-specific capture when available, such as Figma tooling for Figma files or Playwright/browser tools for browser and Electron surfaces.
- Use this skill for desktop apps, OS-level captures, and cases where a tool-specific capture path cannot get the right image.
Use the bundled helpers
Default to the bundled scripts instead of re-deriving native OS commands.
On macOS, run the permission preflight before window or app capture:
bash <path-to-skill>/scripts/ensure_macos_permissions.sh
The helpers route Swift's module cache to $TMPDIR/codex-swift-module-cache to avoid extra module-cache prompts.
Primary helper:
python3 <path-to-skill>/scripts/take_screenshot.py
Common commands
- Named app capture for inspection on macOS:
python3 <path-to-skill>/scripts/take_screenshot.py --app "Figma" --mode temp
- Briefly restore a minimized macOS app, capture it, then minimize it again:
python3 <path-to-skill>/scripts/take_screenshot.py --app "Rudder" --restore-minimized --mode temp
- Specific window title inside an app on macOS:
python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex" --window-name "Settings" --mode temp
- Disambiguate multiple windows on macOS:
python3 <path-to-skill>/scripts/take_screenshot.py --list-windows --app "Codex"
python3 <path-to-skill>/scripts/take_screenshot.py --window-id 12345 --mode temp
- Explicit frontmost-window capture:
python3 <path-to-skill>/scripts/take_screenshot.py --active-window --mode temp
python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --region 100,200,800,600
python3 <path-to-skill>/scripts/take_screenshot.py --path output/screen.png
- Default full-screen capture when the user explicitly wants the desktop:
python3 <path-to-skill>/scripts/take_screenshot.py
The script prints one saved path per capture. When multiple windows or displays match, it prints multiple paths, usually with suffixes like -w<windowId> or -d<display>.
Platform notes
--app, --window-name, and --list-windows are macOS-only.
- On Linux, use
--active-window, --window-id, or --region when you need something narrower than full screen.
- On Windows, use
scripts/take_screenshot.ps1; prefer -ActiveWindow, -Region, or -Path the same way you would use the Python helper flags.
- On macOS, full-screen capture may produce one file per display. On Linux and Windows, full-screen capture usually uses the virtual desktop.
- On Linux, the helper prefers
scrot, then gnome-screenshot, then ImageMagick import.
Fast workflows
- "Take a look at and tell me what you see": use
--app "<App>" --mode temp. Do not start with a full-screen capture, and do not steal focus from whatever the user is doing now.
- "The app is running but probably minimized; take a look anyway": use
--app "<App>" --restore-minimized --mode temp, but only if the user explicitly allows that brief restore/minimize cycle.
- "I only need one panel from an app with multiple windows": use
--list-windows, then --window-id.
- "Grab whatever is frontmost": use
--active-window.
- "Compare implementation against Figma": capture the Figma design with Figma tooling first, then capture the running app with this skill.
Error handling
- On macOS, run
bash <path-to-skill>/scripts/ensure_macos_permissions.sh first to request Screen Recording in one place.
- If macOS app/window capture returns no matches, run
--list-windows --app "AppName" and retry with --window-id, and make sure the app is visible on screen.
- If macOS app capture returns no matches because the app is minimized and the user allows focus changes, retry with
--app "AppName" --restore-minimized. This path intentionally steals focus for a moment, captures the restored window, then minimizes it again and re-activates the previously frontmost app.
- If the frontmost window is Codex, the terminal, or another unrelated app, do not use
--active-window; switch to --app "<TargetApp>" instead.
- If the target app is hidden or off-screen, ask the user to make it visible rather than activating it yourself unless they explicitly asked you to bring it forward.
- If Linux region/window capture fails, check tool availability with
command -v scrot, command -v gnome-screenshot, and command -v import.
- If native helpers fail and you must fall back, use the platform screenshot tool that best matches the requested scope, such as
screencapture, scrot, gnome-screenshot, import, or the bundled Windows PowerShell helper.
- Always report the saved file path in the response.
1---2name: screenshot3description: Use for desktop or system screenshots when the user wants an app, window, region, or whole-desktop capture and no tool-specific capture fits. Prefer app/window capture over full-screen for desktop apps.4---56# Screenshot Capture78Follow these save-location rules every time:9101) If the user specifies a path, save there.112) If the user asks for a screenshot without a path, save to the OS default screenshot location.123) If Codex needs a screenshot for its own inspection, save to the temp directory.1314## Decide the capture scope1516Choose the narrowest capture that matches the task.1718- Do not change focus, bring another app to the front, or otherwise interrupt the user's current work unless they explicitly ask for that behavior.19- If the user names an app, capture that app with `--app` first.20- If the user points at a dialog, settings pane, or titled window, add `--window-name` when possible.21- If the app has multiple candidate windows, run `--list-windows` first and then retry with `--window-id`.22- Use `--active-window` only when the user explicitly wants the current/frontmost window, or when the app is unknown but they can focus it.23- Use a full-screen capture only when the user explicitly wants the desktop, all monitors, or a composition spanning multiple apps.24- For Codex visual inspection of a desktop app, default to `--app "<App>" --mode temp`. Avoid `--active-window` if Codex, the terminal, or another unrelated app is frontmost.25- If a named macOS app is likely minimized and the user explicitly allows a brief focus change, retry with `--restore-minimized` so Codex can restore the app, capture it, then minimize it again and return focus.2627This is the main guardrail for avoiding accidental screenshots of the user's working area.2829## Tool priority3031- Prefer tool-specific capture when available, such as Figma tooling for Figma files or Playwright/browser tools for browser and Electron surfaces.32- Use this skill for desktop apps, OS-level captures, and cases where a tool-specific capture path cannot get the right image.3334## Use the bundled helpers3536Default to the bundled scripts instead of re-deriving native OS commands.3738On macOS, run the permission preflight before window or app capture:3940```bash41bash <path-to-skill>/scripts/ensure_macos_permissions.sh42```4344The helpers route Swift's module cache to `$TMPDIR/codex-swift-module-cache` to avoid extra module-cache prompts.4546Primary helper:4748```bash49python3 <path-to-skill>/scripts/take_screenshot.py50```5152## Common commands5354- Named app capture for inspection on macOS:5556```bash57python3 <path-to-skill>/scripts/take_screenshot.py --app "Figma" --mode temp58```5960- Briefly restore a minimized macOS app, capture it, then minimize it again:6162```bash63python3 <path-to-skill>/scripts/take_screenshot.py --app "Rudder" --restore-minimized --mode temp64```6566- Specific window title inside an app on macOS:6768```bash69python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex" --window-name "Settings" --mode temp70```7172- Disambiguate multiple windows on macOS:7374```bash75python3 <path-to-skill>/scripts/take_screenshot.py --list-windows --app "Codex"76python3 <path-to-skill>/scripts/take_screenshot.py --window-id 12345 --mode temp77```7879- Explicit frontmost-window capture:8081```bash82python3 <path-to-skill>/scripts/take_screenshot.py --active-window --mode temp83```8485- Explicit region crop:8687```bash88python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --region 100,200,800,60089```9091- Explicit output path:9293```bash94python3 <path-to-skill>/scripts/take_screenshot.py --path output/screen.png95```9697- Default full-screen capture when the user explicitly wants the desktop:9899```bash100python3 <path-to-skill>/scripts/take_screenshot.py101```102103The script prints one saved path per capture. When multiple windows or displays match, it prints multiple paths, usually with suffixes like `-w<windowId>` or `-d<display>`.104105## Platform notes106107- `--app`, `--window-name`, and `--list-windows` are macOS-only.108- On Linux, use `--active-window`, `--window-id`, or `--region` when you need something narrower than full screen.109- On Windows, use `scripts/take_screenshot.ps1`; prefer `-ActiveWindow`, `-Region`, or `-Path` the same way you would use the Python helper flags.110- On macOS, full-screen capture may produce one file per display. On Linux and Windows, full-screen capture usually uses the virtual desktop.111- On Linux, the helper prefers `scrot`, then `gnome-screenshot`, then ImageMagick `import`.112113## Fast workflows114115- "Take a look at <App> and tell me what you see": use `--app "<App>" --mode temp`. Do not start with a full-screen capture, and do not steal focus from whatever the user is doing now.116- "The app is running but probably minimized; take a look anyway": use `--app "<App>" --restore-minimized --mode temp`, but only if the user explicitly allows that brief restore/minimize cycle.117- "I only need one panel from an app with multiple windows": use `--list-windows`, then `--window-id`.118- "Grab whatever is frontmost": use `--active-window`.119- "Compare implementation against Figma": capture the Figma design with Figma tooling first, then capture the running app with this skill.120121## Error handling122123- On macOS, run `bash <path-to-skill>/scripts/ensure_macos_permissions.sh` first to request Screen Recording in one place.124- If macOS app/window capture returns no matches, run `--list-windows --app "AppName"` and retry with `--window-id`, and make sure the app is visible on screen.125- If macOS app capture returns no matches because the app is minimized and the user allows focus changes, retry with `--app "AppName" --restore-minimized`. This path intentionally steals focus for a moment, captures the restored window, then minimizes it again and re-activates the previously frontmost app.126- If the frontmost window is Codex, the terminal, or another unrelated app, do not use `--active-window`; switch to `--app "<TargetApp>"` instead.127- If the target app is hidden or off-screen, ask the user to make it visible rather than activating it yourself unless they explicitly asked you to bring it forward.128- If Linux region/window capture fails, check tool availability with `command -v scrot`, `command -v gnome-screenshot`, and `command -v import`.129- If native helpers fail and you must fall back, use the platform screenshot tool that best matches the requested scope, such as `screencapture`, `scrot`, `gnome-screenshot`, `import`, or the bundled Windows PowerShell helper.130- Always report the saved file path in the response.