Commit6cce374cRecorded19 Jul 2026Repositorylantern

lantern: run-slate.sh accepts a URL or web-build dir, not just a repo

Message

Previously run-slate.sh always resolved <arg>/build/web/index.html and rejected anything else. Accept an http/https/file URL (passed straight through to lantern run, which loads it directly) and a bare web-build dir, in addition to a repo folder. Handy for pointing Lantern at a live-hosted build (e.g. sigil serve) with no local build and no caching.

NOTE: loading an http(s) URL in-view still requires relaxing the origin gate in app.sgl's default-nav-handler (which currently sends non-lantern:// URLs to the system browser); tracked separately.

Changed
 run-slate.sh | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)
Diff
run-slate.shmodified
@@ -2,10 +2,12 @@
2
# Launch Slate in a native Lantern window with TRANSPARENCY on + REAL local
3
# fs + pty access.
4
#
5
# ./run-slate.sh [slate-repo-dir] [extra lantern args...]
+5
# ./run-slate.sh [slate-repo-dir | web-build-dir | URL] [extra lantern args...]
6
#
7
# Give it a path to a Slate REPO folder (the one holding build/web/index.html
8
# after `sigil build`). Defaults to the sibling `slate` checkout. It resolves the
+8
# after `sigil build`), a web build dir directly, or an http/https/file URL of a
+9
# hosted build (e.g. `sigil serve` — loaded directly, no local build / no cache).
+10
# Defaults to the sibling `slate` checkout. It resolves the
11
# web build, wraps the run in an ephemeral `guix shell` (the GTK4 + WebKitGTK +
12
# Mesa graphics stack from gl-manifest.scm — no persistent profile), and launches
13
# with --transparent so the window is transparency-CAPABLE.
@@ -25,16 +27,27 @@ LANTERN_BIN="$HERE/build/native/bin/lantern"
27
28
[ -x "$LANTERN_BIN" ] || { echo "missing $LANTERN_BIN — run: sigil build lantern-cli --config native" >&2; exit 1; }
29
28
# Accept either a repo folder (…/build/web/index.html) or a web build dir directly.
29
if [ -f "$SLATE_REPO/build/web/index.html" ]; then SLATE_BUILD="$SLATE_REPO/build/web"
30
elif [ -f "$SLATE_REPO/index.html" ]; then SLATE_BUILD="$SLATE_REPO"
31
else
32
echo "no Slate web build found under: $SLATE_REPO" >&2
33
echo " expected $SLATE_REPO/build/web/index.html (build Slate first: sigil build)" >&2
34
exit 1
35
fi
36
# Normalize to an absolute path so the guix-shell child resolves it correctly.
37
SLATE_BUILD="$(cd "$SLATE_BUILD" && pwd)"
+30
# Accept a URL (http/https/file — served elsewhere, e.g. `sigil serve`), a repo
+31
# folder (…/build/web/index.html), or a web build dir directly. A URL passes
+32
# straight through to `lantern run`, which loads it directly (no lantern:// scheme,
+33
# no local build needed) — handy for testing a live-hosted build with no caching.
+34
case "$SLATE_REPO" in
+35
http://*|https://*|file://*)
+36
SLATE_BUILD="$SLATE_REPO"
+37
;;
+38
*)
+39
if [ -f "$SLATE_REPO/build/web/index.html" ]; then SLATE_BUILD="$SLATE_REPO/build/web"
+40
elif [ -f "$SLATE_REPO/index.html" ]; then SLATE_BUILD="$SLATE_REPO"
+41
else
+42
echo "no Slate web build found under: $SLATE_REPO" >&2
+43
echo " expected $SLATE_REPO/build/web/index.html (build Slate first: sigil build)" >&2
+44
echo " (or pass an http://…/https://…/file://… URL to load a hosted build)" >&2
+45
exit 1
+46
fi
+47
# Normalize to an absolute path so the guix-shell child resolves it correctly.
+48
SLATE_BUILD="$(cd "$SLATE_BUILD" && pwd)"
+49
;;
+50
esac
51
52
echo "==> Slate repo: $SLATE_REPO"
53
echo "==> Slate build: $SLATE_BUILD"