Repository Public
1#!/usr/bin/env bash2# Launches the Debug build with a throw-away data folder, shows an AURA surface and captures the window.3# Only the instance it launched is captured and quit (by PID): a running SP Browser of the user is never touched.4# Usage: scripts/aura-shot.sh <out.png> [surface] [comma-separated urls] [ambient theme] [seconds before capture]5set -uo pipefail6cd "$(dirname "$0")/.."7OUT="$1"; SURFACE="${2:-}"; URLS="${3:-}"; AMBIENT="${4:-aurora}"; WAIT="${5:-11}"8APP="${SPB_APP:-build/DerivedData/Build/Products/Debug/SPBrowser.app}"9DIR="SPB-Aura-Shot-$$"10ARGS=(-SPBDataDir "~/Library/Application Support/$DIR" -SPBAmbient "$AMBIENT" -ApplePersistenceIgnoreState YES)11[[ -n "$SURFACE" ]] && ARGS+=(-SPBAura "$SURFACE")12[[ -n "$URLS" ]] && ARGS+=(-SPBOpenURLs "$URLS")13[[ -n "${SPB_APPEARANCE:-}" ]] && ARGS+=(-AppleInterfaceStyle "$SPB_APPEARANCE")14"$APP/Contents/MacOS/SPBrowser" "${ARGS[@]}" >/dev/null 2>&1 &15PID=$!16sleep "$WAIT"17swift scripts/window-shot.swift --pid "$PID" "$OUT"18kill "$PID" 2>/dev/null19wait "$PID" 2>/dev/null20for C in "$HOME/Library/Containers/ai.spboucher.spbrowser.debug/Data/Library/Application Support" "$HOME/Library/Containers/ai.spboucher.spbrowser/Data/Library/Application Support"; do rm -rf "$C/$DIR"; done21