#!/bin/bash # make-app.sh — build a double-clickable "Personal Dashboard.app" (no Terminal # window) that starts the dashboard in the background and opens the browser. # Run once: bash scripts/make-app.sh → creates ./Personal Dashboard.app set -euo pipefail REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" APP="$REPO/Personal Dashboard.app" LAUNCH="$REPO/scripts/launch.command" chmod +x "$LAUNCH" # AppleScript: run the launcher detached (survives the .app exiting), then open # the browser once the server answers. nohup + disown keeps the server alive. read -r -d '' SCRIPT </tmp/personal-dashboard.log 2>&1 & disown" -- give the server a moment, then open (launcher also opens on ready) repeat 30 times try do shell script "curl -sf http://localhost:4317/api/health >/dev/null" exit repeat on error delay 1 end try end repeat open location "http://localhost:4317" end run APPLESCRIPT rm -rf "$APP" osacompile -o "$APP" -e "$SCRIPT" # Use the generated PWA icon for the app, if available. ICON_SRC="$REPO/public/icons/icon-512.png" if [ -f "$ICON_SRC" ] && command -v sips >/dev/null 2>&1; then TMP_ICONSET="$(mktemp -d)/icon.iconset" mkdir -p "$TMP_ICONSET" for s in 16 32 64 128 256 512; do sips -z $s $s "$ICON_SRC" --out "$TMP_ICONSET/icon_${s}x${s}.png" >/dev/null 2>&1 || true d=$((s*2)); sips -z $d $d "$ICON_SRC" --out "$TMP_ICONSET/icon_${s}x${s}@2x.png" >/dev/null 2>&1 || true done if command -v iconutil >/dev/null 2>&1; then iconutil -c icns "$TMP_ICONSET" -o "$APP/Contents/Resources/applet.icns" 2>/dev/null || true fi fi echo "Created: $APP" echo "Double-click it (or drag to the Dock). First launch builds, then opens the browser."