#!/usr/bin/env bash # Compatibility entry point for the native SwiftUI GUI. Electron is retired. set -euo pipefail fail() { printf 'aesel: %s\n' "$*" >&2; exit 1; } case "${1:-}" in -h|--help) cat <<'HELP' Usage: aesel a [directory] [TUI options] Open the native Aesel Mac app, or activate its existing window. The native GUI manages its own saved threads; terminal workspace flags belong to a. Install the native Mac beta from https://aesel.app or build apple/aesel with Xcode. AESEL_DESKTOP_APP can select a native app bundle explicitly. HELP exit 0 ;; esac [[ $# == 0 ]] || fail 'the native GUI takes no workspace or engine flags; use a for the TUI (see aesel --help)' [[ "$(uname -s)" == Darwin ]] || fail 'the native GUI requires macOS; use a for the terminal interface' app_path="${AESEL_DESKTOP_APP:-${EASEL_DESKTOP_APP:-}}" if [[ -z "$app_path" ]]; then for candidate in "$HOME/Applications/Aesel.app" '/Applications/Aesel.app' "$HOME/Applications/Aesel Native.app" '/Applications/Aesel Native.app'; do if [[ -d "$candidate" ]]; then app_path="$candidate"; break; fi done fi [[ -n "$app_path" && -d "$app_path" ]] || fail 'Aesel Native.app is not installed. Install the native Mac beta from https://aesel.app or run a.' bundle_id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$app_path/Contents/Info.plist" 2>/dev/null || true) [[ "$bundle_id" == computer.aesthetic.aesel.native || ( "$bundle_id" == computer.aesthetic.easel && -f "$app_path/Contents/Resources/Session/easel/phone/host.html" && ! -d "$app_path/Contents/Frameworks/Electron Framework.framework" ) ]] || fail 'that bundle is not Aesel Native; the Electron app is retired. Install the native Mac beta from https://aesel.app.' exec open -a "$app_path"