#!/usr/bin/env bash # Take the README screenshots: build arr-tui, start the fake services with the # made-up library, and run every scene in Ghostty on a virtual X display. The # pictures go to docs/screenshots/ (losslessly compressed if oxipng is there). # # Needs: go, python3, ghostty, xvfb-run (Xvfb), xdotool, ImageMagick 7, # fontconfig with DejaVu fonts; oxipng optional. On NixOS: # nix-shell -p xvfb-run xorg-server xdotool imagemagick oxipng --run dev/screenshots/take.sh set -euo pipefail here=$(cd "$(dirname "$0")" && pwd) repo=$(cd "$here/../.." && pwd) out=$repo/docs/screenshots # The Config view shows the config file's path; keep it neutral. demo=/tmp/arr-tui-demo for tool in go python3 ghostty xvfb-run xdotool magick fc-match; do command -v "$tool" >/dev/null || { echo "take.sh: $tool is missing" >&2; exit 1; } done work=$(mktemp -d) cleanup() { [[ -n ${server:-} ]] && kill "$server" 2>/dev/null rm -rf "$work" "$demo" } trap cleanup EXIT echo "building arr-tui" go build -C "$repo" -o "$work/arr-tui" ./cmd/arr-tui [[ -d $here/posters ]] || { echo "generating posters"; "$here/posters.sh"; } echo "starting the fake Radarr, Sonarr, SABnzbd and Trakt" export ARR_TUI_TRAKT_URL=http://127.0.0.1:19894 python3 "$here/server.py" & server=$! sleep 1 # One config per theme, each at $demo//.config/arr-tui/config.json. for theme in dark light; do mkdir -p "$demo/$theme/.config/arr-tui" cat >"$demo/$theme/.config/arr-tui/config.json" </dev/null; then oxipng -o 4 --strip safe -q "$out"/*.png fi echo "screenshots in $out:" ls "$out"