Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

ci, docs: schemes.json in the web bundle; rustup on PATH for packaging

RoversX247eaba5b556
diff --git a/.gitignore b/.gitignore
index 421b5005..15146e88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,5 +104,6 @@ __pycache__/
/thinkterm-web/www/fonts/
/thinkterm-web/www/assets/
/thinkterm-web/www/index.html
+/thinkterm-web/www/schemes.json
/thinkterm-web/www/*.gz
/thinkterm-web/ui/node_modules/
diff --git a/ci/build-web.sh b/ci/build-web.sh
index 7db1f6f2..e6aa8985 100755
--- a/ci/build-web.sh
+++ b/ci/build-web.sh
@@ -30,6 +30,10 @@ wasm-bindgen --target web --out-dir "$OUT/pkg" "$WASM"
if command -v wasm-opt >/dev/null 2>&1 && [ "$PROFILE" = release ]; then
wasm-opt -Oz -o "$OUT/pkg/thinkterm_web_bg.wasm" "$OUT/pkg/thinkterm_web_bg.wasm"
fi
+# The colour-scheme table the picker fetches. Compiled into the binary, so
+# this is a build step and not a file in the tree.
+cargo build -p wezterm --bin thinkterm $CARGO_FLAGS
+"$TARGET_DIR/$PROFILE/thinkterm" cli color-schemes --json > "$OUT/schemes.json"
mkdir -p "$OUT/fonts"
cp assets/fonts/JetBrainsMono-Regular.ttf assets/fonts/SymbolsNerdFontMono-Regular.ttf "$OUT/fonts/"
# The page itself. Vite writes index.html and assets/ into $OUT and leaves
@@ -46,7 +50,7 @@ npm run --prefix "$UI" --silent build
# once here instead of per request, and -9 beats what a server would spend
# in a request's time. -n leaves out the name and timestamp so the output
# is the same for the same input.
-for f in "$OUT/index.html" "$OUT/assets"/*.js "$OUT/assets"/*.css "$OUT/pkg"/*.js "$OUT/pkg"/*.wasm "$OUT/fonts"/*.ttf; do
+for f in "$OUT/index.html" "$OUT/schemes.json" "$OUT/assets"/*.js "$OUT/assets"/*.css "$OUT/pkg"/*.js "$OUT/pkg"/*.wasm "$OUT/fonts"/*.ttf; do
[ -f "$f" ] || continue
gzip -9 -n -c "$f" > "$f.gz"
done
diff --git a/ci/deploy.sh b/ci/deploy.sh
index a712b75d..4f2cb363 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -71,7 +71,7 @@ case $OSTYPE in
# -p throughout: the server decides whether a .gz still stands for
# its file by comparing their modification times, and a copy that
# rewrites them can make a stale sibling look current.
- cp -p thinkterm-web/www/index.html $zipdir/ThinkTerm.app/Contents/Resources/web/
+ cp -p thinkterm-web/www/index.html thinkterm-web/www/schemes.json $zipdir/ThinkTerm.app/Contents/Resources/web/
# The precompressed siblings, when ci/build-web.sh made them.
for gz in thinkterm-web/www/*.gz ; do
[[ -f "$gz" ]] && cp -p "$gz" $zipdir/ThinkTerm.app/Contents/Resources/web/
@@ -240,7 +240,7 @@ case $OSTYPE in
# times the .gz freshness check reads.
if require_web_bundle ; then
mkdir -p $zipdir/web
- cp -p thinkterm-web/www/index.html $zipdir/web/
+ cp -p thinkterm-web/www/index.html thinkterm-web/www/schemes.json $zipdir/web/
for gz in thinkterm-web/www/*.gz ; do
[[ -f "$gz" ]] && cp -p "$gz" $zipdir/web/
done
@@ -604,7 +604,7 @@ EOF
# server finds it at <exe>/../share/thinkterm/web.
if require_web_bundle ; then
# -p keeps the modification times the .gz freshness check reads.
- install -Dpm644 -t "$tardir/share/thinkterm/web" thinkterm-web/www/index.html
+ install -Dpm644 -t "$tardir/share/thinkterm/web" thinkterm-web/www/index.html thinkterm-web/www/schemes.json
for gz in thinkterm-web/www/*.gz ; do
[[ -f "$gz" ]] && install -Dpm644 -t "$tardir/share/thinkterm/web" "$gz"
done
diff --git a/ci/macos-package.sh b/ci/macos-package.sh
index 1566c8b0..2322aba0 100755
--- a/ci/macos-package.sh
+++ b/ci/macos-package.sh
@@ -233,9 +233,13 @@ BIN_DIR="target/$RUST_TARGET/release"
# `rustc` on PATH is often the one Homebrew installed, and a toolchain from a
# package manager carries only its own host's standard library: a cross build
# against it dies in the first dependency with E0463. rustup's has both, so
-# prefer it whenever there is one.
-if toolchain_bin=$(rustup which cargo 2>/dev/null); then
- PATH="$(dirname "$toolchain_bin"):$PATH"
+# prefer it whenever there is one -- through rustup's proxies, not the
+# toolchain's own bin directory: run bare, rust-lld and rust-objcopy cannot
+# find libLLVM.dylib (the proxies set the dyld fallback path) and the wasm
+# link dies with SIGABRT.
+if rustup_bin=$(command -v rustup 2>/dev/null) &&
+ [[ -x "$(dirname "$rustup_bin")/cargo" ]]; then
+ PATH="$(dirname "$rustup_bin"):$PATH"
fi
echo "==> Checking prerequisites"
diff --git a/docs/thinkterm/web-access.md b/docs/thinkterm/web-access.md
index fd2cf11c..3b62a132 100644
--- a/docs/thinkterm/web-access.md
+++ b/docs/thinkterm/web-access.md
@@ -5,8 +5,9 @@
ThinkTerm's multiplexer can serve a browser client. One TCP port per
`web_servers` entry delivers the page, its JavaScript and wasm over HTTP and
accepts a WebSocket that speaks the same protocol as every other client. The
-browser mirrors a pane the way the desktop does and takes over input the
-moment you type into it.
+browser draws a tab the way the desktop does and holds it: a tab it shows
+is claimed at the browser's own shape, and the desktop takes it back only
+when someone interacts there.
## `web_servers`
@@ -181,13 +182,16 @@ not hold the terminal in Handoff mode sees the desktop's card ("Terminal is
being used on another device -- Click or scroll to continue") over the
mirror, which stays visible.
-The tab keeps the desktop's size and shape. The page's own font size is
+A tab the page shows is reshaped to this window as soon as it is on
+screen, so the page is the terminal's size while it holds it. Only while
+the desktop holds the tab (someone interacted there) does the page keep
+the desktop's size and shape instead: the page's own font size is then
derived from the desktop's cell so that a cell here is as large as one
-there, and the desktop's pixel geometry (the bar above each pane, the
-padding around the grid) lands on the page one to one; the page clips when
-the tab is larger than the window and says so in the tab row. `?font=`
-pins a size instead; Ctrl+Shift+F fits the tab to this window until the
-desktop next takes it. Every claim the page makes is pane by pane
+there, the desktop's pixel geometry (the bar above each pane, the padding
+around the grid) lands on the page one to one, and the page clips when
+the tab is larger than the window and says so in the tab row; a click or
+a keystroke takes the tab back at this window's shape. `?font=` pins a
+size; Ctrl+Shift+F reshapes the tab to this window on demand. Every claim the page makes is pane by pane
(`ClientViewport::Native`): taking the terminal over from the desktop
changes no pane's grid, and a tab a CLI laid out gets the same rows above
each pane the desktop would leave.
@@ -233,6 +237,26 @@ tab; the remark stays while it is down. It gives up only when there is
nothing to come back to -- the server has no panes, or speaks a different
protocol version -- and says which.
+### Colours
+
+The terminal draws with the colour scheme the **server** is configured with:
+`color_scheme` (or `colors`) in `thinkterm.lua`, resolved once and pushed to
+every client as `DefaultPalette` right after the handshake, and again
+whenever the configuration reloads. A program's own OSC 4/10/11 colours
+still win over it, per pane, exactly as on the desktop.
+
+Settings → Appearance → **Color scheme** overrides that for this browser
+alone: "Follow the desktop", or any of the built-in schemes, searchable with
+a swatch and a live preview. The pick is kept in `localStorage` with its
+colours, so a reload draws in it before anything is fetched. The table
+itself is a build output -- `ci/build-web.sh` runs `thinkterm cli
+color-schemes --json` into `thinkterm-web/www/schemes.json`, which the
+picker fetches the first time it opens.
+
+`DefaultPalette` arrived with **codec version 70**; a server older than that
+simply never pushes it, and the page falls back to the stock palette unless
+this browser picked a scheme.
+
## Fonts
The page ships two faces (JetBrains Mono, Symbols Nerd Font Mono) and shapes