#!/usr/bin/env bash # Regenerates the screenshots in docs/images. Runs ghosttyconf with a demo # config in a detached tmux session, drives it with key presses and renders # the captured screens with tools/termsvg. Needs tmux and Ghostty. set -euo pipefail cd "$(dirname "$0")/.." OUT=docs/images THEME=${THEME:-Catppuccin Mocha} COLS=144 ROWS=34 SESSION=ghosttyconf-shots tmp=$(mktemp -d) trap 'tmux kill-session -t "$SESSION" 2>/dev/null || true; rm -rf "$tmp"' EXIT go build -o "$tmp/ghosttyconf" . go build -o "$tmp/termsvg" ./tools/termsvg mkdir -p "$OUT" "$tmp/home/.config/ghostty" cat > "$tmp/home/.config/ghostty/config.ghostty" <<'EOF' # Ghostty configuration # https://ghostty.org/docs/config theme = Catppuccin Mocha font-family = JetBrains Mono font-size = 14 font-thicken = true cursor-style = bar cursor-color = #f5e0dc selection-background = #585b70 window-padding-x = 12 window-padding-y = 8 window-save-state = always background-opacity = 0.95 macos-titlebar-style = tabs shell-integration-features = no-cursor,sudo,title copy-on-select = clipboard keybind = super+d=new_split:right keybind = super+shift+d=new_split:down keybind = super+k=unbind keybind = ctrl+grave_accent=toggle_quick_terminal EOF # HOME points at the demo so the title bar shows ~/.config/ghostty/…, and the # update check stays off so no "newer release" lands in a screenshot. tmux new-session -d -s "$SESSION" -x $COLS -y $ROWS \ "cd '$tmp/home' && env HOME='$tmp/home' COLORTERM=truecolor GHOSTTYCONF_NO_UPDATE_CHECK=1 '$tmp/ghosttyconf' --no-reload" sleep 2 keys() { for k in "$@"; do tmux send-keys -t "$SESSION" "$k" sleep 0.15 done sleep 0.5 } # raw sends a key as the kitty keyboard protocol encodes it, the way Ghostty # reports keys while a binding is being recorded. raw() { tmux send-keys -t "$SESSION" -l "$1" sleep 0.5 } shot() { tmux capture-pane -t "$SESSION" -e -p > "$tmp/$1.ans" "$tmp/termsvg" -theme "$THEME" -title ghosttyconf -o "$OUT/$1.svg" "$tmp/$1.ans" echo "wrote $OUT/$1.svg" } down() { for _ in $(seq "$1"); do tmux send-keys -t "$SESSION" Down; done sleep 0.5 } shot main # Theme picker with the live preview of the highlighted theme. keys Enter t o k y o Down shot picker keys Escape # Key binding manager: move new_split:right from super+d to super+\. keys b / s p l i t Enter down 11 keys Enter C-r raw $'\e[?9u' # Ghostty's answer to the protocol query; tmux has none raw $'\e[92;9u' shot record keys Enter Enter / s p l i t Enter down 11 shot keybinds keys Escape Escape # Two more edits, then the list of unsaved changes. keys Down Down + down 9 keys space c shot changes