Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556#!/usr/bin/env bash# slab-web — open a frameless WEB preview in slab.## Two backends:# (default) AC Electron app — chromeless, CDP-attached (:9222), auto-tiles# into the terminal grid via the slab menubar's AXTiler.# --chrome your REAL Google Chrome, --app (frameless) mode, using your main# profile — so it's logged into everything you are (GitHub, etc.).# Best for authed pages (e.g. private PRs). Uses the running Chrome# instance (your session); CDP only if Chrome was started with a# --remote-debugging-port, and Chrome --app windows aren't# auto-tiled (can't be told apart from your normal Chrome windows).## Usage:# slab-web <url|path|$code># slab-web --chrome https://github.com/fuserstudio/fuser/pull/608# slab-web ~/aesthetic-computer/studies/spatial-flow.htmlset -euo pipefailAPP="Aesthetic.Computer"CHROME=0if [ "${1:-}" = "--chrome" ] || [ "${1:-}" = "-c" ]; then CHROME=1; shift; fiurl="${1:-}"[ -n "$url" ] || { echo "usage: slab-web [--chrome] <url|path>" >&2; exit 1; }case "$url" in http://*|https://*|file://*) : ;; # full URL — as-is /*) url="file://$url" ;; # absolute path ./*|../*|*/*) url="file://$(cd "$(dirname "$url")" && pwd)/$(basename "$url")" ;; # relative path *.html) url="file://$PWD/$url" ;; # bare file in cwd *) url="https://aesthetic.computer/$url" ;; # bare token → AC piece/$codeesacif [ "$CHROME" = "1" ]; then # Real Chrome, --app (frameless) mode, main profile (authed). Invoke the # binary directly so a running Chrome forwards the new app window into your # existing session instead of spawning an isolated instance. chrome="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" [ -x "$chrome" ] || { echo "Google Chrome not found at $chrome" >&2; exit 1; } "$chrome" --app="$url" >/dev/null 2>&1 & disown exit 0fi# Default: AC Electron preview (chromeless, CDP, tiled). Resolve the installed# app (prefer /Applications; fall back to a Spotlight lookup by bundle id).app_path="/Applications/$APP.app"[ -d "$app_path" ] || app_path="$(mdfind "kMDItemCFBundleIdentifier == 'computer.aesthetic.app'" 2>/dev/null | head -1)"# `open -na … --args --preview=<url>` routes through the AC app's single-instance# lock so the running instance opens the preview window (cold-launches if not up).# Equals form: Chromium can inject switches into argv; a space-separated# `--preview <url>` risks pairing the flag with an injected switch.exec open -na "$app_path" --args "--preview=$url"