ztorrent is a thin Tauri v2 host: the window, the native menu bar, the shared embeds and the app shell. Every feature is a command on the ztorrent-core engine, and the client UI is that crate’s mountable view, vendored into frontend/ at build time.
Host structure
| Piece | What it does |
|---|---|
| app/src-tauri/src/lib.rs | Registers the engine bridge (ztr_invoke), the shared file-browser and terminal commands, the powerline stats command and the stryke hook runner; wires engine events to the webview |
| native_menu.rs | Torrent / Queue / Session / Tools / View menus — verify, reannounce, rename, reveal, start-now, message log, statistics, compact view; every id round-trips to the same handler the ⌘K palette calls |
| bus.rs | The GUI Automation Bus socket, so App::open("ztorrent") can drive the app |
| stryke_runner.rs · stryke_lsp.rs | Runs the app’s stryke lifecycle hooks and backs the hooks editor’s language server |
| frontend/main.js | Mounts ZGui.appShell, feeds it the view’s palette, and renders Transmission’s preference groups — including remote control, power and the auto-assign Groups editor — into the shell’s one settings panel |
| frontend/ztorrent.js | The client view itself — vendored from crates/ztorrent-core/webui, never forked |
Shared modules it mounts
| Module | Role |
|---|---|
| zgui-core | The widget toolkit and the app shell (palette, settings, colourscheme, splash, powerline, tmux tiling) |
| zpwr-embed-terminal | The PTY terminal pane (Ctrl+` / ⌘⌥T) |
| zpwr-file-browser | The multi-pane file browser overlay (⌘B) over the host’s fs backend |
| zpwr-hooks-editor | The Monaco stryke hooks editor (⌘⇧H) |
| zpwr-i18n | The interface localization runtime |
| zpwr-clip-engine · zwire-host | The shared sequencer grid and the live system stats behind the powerline |
Hook points
The app publishes five stryke hook points — torrent.added, torrent.completed, torrent.removed, seeding.stopped and altspeed.changed — so a script can move a finished download, notify something, or react to the scheduler flipping turtle mode. They are edited in the shared hooks overlay and run through the app’s stryke runner.
Test status
pnpm test runs both suites: 247 Rust tests in the engine and 17 headless webui tests, 264 in total. The webui suite asserts that every call goes through the ztr_invoke bridge and that the view feeds the host shell instead of binding a global key — the rule that keeps an embedded core from fighting its host for ⌘K.