Use a Tk desktop app from a web browser, with no changes to the app.
WebWish runs the program headless on a server and streams its screen to a canvas in a browser tab. Your mouse and keyboard go back over a WebSocket. To the app, it's just another SDL2 video driver.
Two-minute tour
How it works, trying it, mouse and keyboard, lossless tiles, typing, AV1 video, many users on one port, and locking it down.
What it's for
WebWish works for anything that draws through SDL's software framebuffer. It was built to run undroidwish, AndroWish's Tcl/Tk on SDL, inside a browser.
The app picks the driver with SDL_VIDEODRIVER=wstiles and draws as usual. The browser shows it, and the session resizes to fit the browser window.
Only changed 64×64 tiles are sent, compressed. The first paint of a flat 1024×768 screen is about 19 KB instead of 3 MB. AV1 video is an option for busy, animated screens.
A reference NaviServer bridge gives each browser tab its own private process, started when it connects and cleaned up when it leaves.
Each session can run in a hardened container with no network. The stdio transport means no per-session port is opened. Read SECURITY.md before exposing it.
Get started
Prebuilt Docker images for x86-64 and arm64 are on the GitHub release. Building it yourself means patching the driver into AndroWish's SDL2 fork; see docs/BUILDING.md.
Pick the image for your machine, in the lossless-tiles or AV1 variant, and load it with docker load. No build needed.
Given a binary, set SDL_VIDEODRIVER=wstiles and SDL_VIDEO_WSTILES_PORT=8090, run your Tcl app, then open http://localhost:8090/.
Drop the server/ bridge into a NaviServer docroot. Put an app.tcl beside it and that's the app every session runs. Add authentication and a session cap first.
Technical details
WebWish serves any SDL2 / Tk desktop application as a web app, with no changes to the app. It runs the program headless on a server and renders and controls it in a browser tab: the app's framebuffer is streamed to an HTML <canvas> over a WebSocket, and the viewer's mouse and keyboard travel back the same way. To the app, WebWish is another SDL video backend.
The driver works for anything that renders through SDL's software framebuffer path. The original target is undroidwish, AndroWish's Tcl/Tk-on-SDL runtime, run inside a browser.
The driver's internal name is wstiles (it appears in the environment variables and the on-the-wire handshake magic wtil). The project name is WebWish.
WebWish is an SDL2 video driver. When an SDL2 app selects it (SDL_VIDEODRIVER=wstiles), the app draws into an in-memory framebuffer the driver hands it, and the driver moves pixels to the browser and events back.
SDL_PIXELFORMAT_ABGR8888, whose little-endian byte order is R, G, B, A — what the browser's putImageData expects, so no per-pixel conversion is needed.DecompressionStream("deflate") and paints it independently.SDL_VIDEO_WSTILES_CODEC=av1, the driver hands each changed frame to a realtime AV1 encoder (libaom, tune=screen, 4:4:4) and the browser decodes it with the WebCodecs VideoDecoder. There is a live constant-quality knob and a bandwidth meter. From benchmarking: lossless tiles are smaller on flat UI (typically ~0.1 ms per tile, and smaller than AV1 for a static screen); AV1 is smaller on large animated or photographic change, e.g. a live shot graph.window.WSTILES_AUTORESIZE = false, or cap it with SDL_VIDEO_WSTILES_SIZE.Three transports are available, chosen by environment variable:
[u32-be len][payload] frames on stdin/stdout, so an external proxy can bridge it. This is what the NaviServer reference bridge uses, and it means a container's stdin/stdout is the wire — no per-session port is opened.A reference NaviServer bridge multiplexes many independent sessions through a single public port: each browser tab gets its own private process, spawned on connect and reaped on disconnect. The bridge is event-driven and runs off the connection-thread pool; an idle server measures ~0% CPU, and it handles many concurrent viewers.
The complete byte-level wire format is documented in the repository's docs/WIRE-PROTOCOL.md.
Working alpha. As of mid-2026 the following are all verified live:
Prebuilt Docker images are published as a GitHub release: x86-64 and arm64, in lossless-tiles and AV1 variants.
Limitations: no touch input (mouse events only, so phones/tablets cannot drive a session); clipboard is one-way (server→browser frames are dropped by the client); WarpMouse is unimplemented; there is no shared multi-viewer stream (each viewer drives its own process); and it is a patch into an SDL2 build tree, not a drop-in shared library. Neither reference bridge authenticates or caps sessions on its own — see the security note below.
Exposing a GUI app to untrusted users — especially undroidwish's default Tcl console — is remote code execution as a service. WebWish uses defense-in-depth; read the repository's SECURITY.md before exposing it to anyone:
--network none, read-only rootfs, non-root user, --cap-drop ALL, no-new-privileges, and pid/memory/CPU caps. Because the stdio transport makes the container's stdin/stdout the wire, no per-session port is even opened. For anonymous exposure, escalate to a stronger sandbox (e.g. gVisor or a microVM).WebWish is a driver compiled into an SDL2 build and linked against. Constraint: it targets AndroWish's SDL2 fork (SDL 2.0.6), not stock upstream SDL2 — several internal APIs differ enough that stock SDL will not compile. The repository's docs/BUILDING.md states the requirement and the source layout; patches/ documents the edits that wire the driver into an SDL2 tree.
The prebuilt Docker image plus the bundled bridge requires no build:
# load the image for your architecture
gunzip -c webwish-undroidwish-amd64-tiles.tar.gz | docker load
# one hardened session; stdio is the wire, so no port is opened
docker run --rm -i --network none --read-only --tmpfs /tmp \
--user 65534:65534 --cap-drop ALL --security-opt no-new-privileges \
--pids-limit 128 --memory 256m --cpus 1 \
webwish/undroidwish:latest-amd64
Given a binary, the driver's own server serves it directly:
SDL_VIDEODRIVER=wstiles SDL_VIDEO_WSTILES_PORT=8090 \
./undroidwish-wstiles yourapp.tcl
# then open http://localhost:8090/
For many users on one port, the self-contained server/ bridge drops into any NaviServer docroot subdirectory with nothing to edit — stream.adp locates its siblings relative to itself, and dropping an app.tcl beside it makes that the app each session runs. For an existing NaviServer, docs/DEPLOY-NAVISERVER.md documents a no-build deploy (load an image, copy one directory).
Key environment variables:
| Variable | Effect |
|---|---|
SDL_VIDEODRIVER=wstiles |
select this driver |
SDL_VIDEO_WSTILES_PORT=<n> |
built-in server listen port |
SDL_VIDEO_WSTILES_STDIO=1 |
length-prefixed frames on stdin/stdout instead |
SDL_VIDEO_WSTILES_CODEC=av1 |
whole-screen AV1 instead of lossless tiles |
SDL_VIDEO_WSTILES_CQ=<12..63> |
AV1 constant-quality (lower = sharper/bigger) |
SDL_VIDEO_WSTILES_ONESHOT=1 |
exit when the last client disconnects |
SDL_VIDEO_WSTILES_SIZE=WxH |
maximum framebuffer size (default 1024×768) |
ABGR8888 so the framebuffer's byte layout matches putImageData eliminates a conversion pass on every frame.tune=screen (which fixes the text-blur of the older MPEG-1 path) for animated/photographic content — with a measured keyframe often ~2× smaller than a full zlib frame and clock-tick deltas of ~100 bytes.ABGR8888 — which includes iOS (uikit) as well as wstiles — and is carried as a documented patch.Source, build recipes, wire-protocol spec, security model, and prebuilt images: github.com/johnbuckman/WebWish. Released under the zlib license (the same as SDL); driver/SDL_wstiles.c is derived from SDL's SDL_jsmpeg.c.
docs/AGENT-BOOTSTRAP.md documents current state, build recipes for both architectures, the bugs already solved (with the wrong theories that were ruled out), and the traps to avoid.