.qgif Format Documentation
QuikGIF scripts are line-oriented text files that automate multi-step GIF demo creation. Each line is a command with arguments. Scripts are executed with the quikgif script command:
Scripts can open applications, capture windows, simulate keyboard and mouse input, apply visual effects, and render the result as an optimized GIF -- all from a single .qgif file.
# are ignored. Inline comments with # are also supported.as $name in capture-window and run commands. Referenced as $name, indexed as $name[N]. String interpolation: "hello $name".\n, \t, \\, \" escape sequences.30, 0.5).Configure script behavior with set <key> <value>. Settings apply from the point they are declared.
| Setting | Type | Default | Description |
|---|---|---|---|
fps | int | 30 | Recording frame rate (12, 24, 30, 60) |
output | string | output.gif | Output file path |
max-width | int | 800 | Maximum GIF width in pixels |
loop-count | int | 0 | GIF loop count (0 = infinite, 1 = once, 3 = three) |
transition | float | 0.3 | Crossfade duration between segments (seconds) |
show-cursor | bool | true | Show system cursor in recording |
cursor-smoothing | bool | false | Enable cursor path smoothing |
click-indicators | bool | false | Show visual click indicators |
type-smoothing | bool | false | Smooth keystroke timing |
idle-strategy | string | (disabled) | Idle frame handling: fade, cut, or ramp |
idle-threshold | float | 2.0 | Seconds of inactivity before idle strategy applies |
include-title-bar | bool | false | Keep real window title bar in output (overrides faux-title-bar) |
title-bar-height | int | 28 | Points to paint over (use 52 for Terminal.app with tabs) |
faux-title-bar | bool | true | Paint synthetic macOS title bar over window captures (false = crop instead) |
faux-title-bar-title | string | (empty) | Text shown centered in faux title bar |
palette-strategy | string | auto | GIF palette: auto, global, or perFrame |
cleanup | bool | true | Close script-opened windows after render |
strict | bool | true | Fail on non-zero shell command exit codes |
run-timeout | float | 30 | Shell command timeout in seconds |
Boolean settings use true/false string values.
open <app>Open an application and create a new window.
focus <app>Bring an application's window to the front.
capture-window app <name> as $varcapture-window id <windowID> as $varCapture a window reference for recording. The as $var binding is optional.
resize <width> <height>Resize the target window (captured or recording) to the given dimensions.
clearSend Cmd+K to the target window (clears Terminal, works in many apps).
record $window [duration <seconds>] [continue]Start recording a window. Without duration, records until stop or next record. Without continue, blocks for the full duration. With continue, execution continues while recording runs in the background.
record region <x> <y> <w> <h> [duration <seconds>] [continue]Record an absolute screen region by coordinates (in points). No window selection needed — captures everything visible in the rectangle. Useful for headless automation.
record $window crop <x> <y> <w> <h> [duration <seconds>] [continue]Record a sub-region of a window. Coordinates are relative to the window's content area (below the title bar). Captures only that window's content regardless of Z-order or focus.
stopStop the active recording.
remainWait for the remaining duration of the current record ... duration N continue block.
renderStop any active recording and immediately render the GIF. If omitted, rendering happens automatically at script end.
type <text> [enter] [delay <seconds>]Simulate typing text. enter presses Return after typing. delay sets per-character delay (default 0.05s).
click [<x> <y>] [right]Simulate a mouse click. Without coordinates, clicks at the current cursor position.
move <x> <y> [duration <seconds>]Smoothly move the cursor to coordinates (default duration 0.3s).
cursor <x> <y>Instantly set cursor position (no animation).
scroll <direction> [<ticks>]Simulate scroll wheel. Direction: up, down, left, right. Default 3 ticks.
key <keyspec>Simulate a key press. Modifiers joined with +.
wait <seconds>Pause execution for a number of seconds.
wait-for-idle <seconds>Wait until screen content stabilizes (no new frames for ~400ms) or until the timeout.
run <command> [as $var]Execute a shell command via /bin/sh -c. Optionally capture output lines to a variable.
Always sets $_exitcode to the command's exit code. If as $var is used and the command writes to stderr, $var_stderr is also set.
In strict mode (default), a non-zero exit code throws an error. Disable with set strict false.
spotlight stdout $var[N] duration <seconds>spotlight region <x> <y> <width> <height> duration <seconds>Highlight a region of the recording. stdout mode estimates line position from captured output.
spotlight-shift <target> duration <seconds>Animate the spotlight from its previous position to a new target.
clear-fxRemove all active visual effects.
Variables are created by capture-window ... as $name and run ... as $name.
| Variable | Set By | Type | Description |
|---|---|---|---|
$name | capture-window | Window ID | The captured window's numeric ID |
$name | run | Lines | Stdout split into lines |
$name[N] | run | String | Nth line of captured output (0-indexed) |
$name_stderr | run | String | Stderr output (set when non-empty) |
$_exitcode | run | String | Exit code of the last run command |
Variable interpolation in strings: "File: $name" substitutes the variable's value.
--dry-run performs static analysis:
recordrecord commandsrenderSee the examples/ directory for complete scripts:
hello.qgif -- Basic Terminal recordinggit-workflow.qgif -- Multi-command git demomulti-window.qgif -- Multi-window recording with segment stitchingspotlight-demo.qgif -- Spotlight effects and stdout highlighting