Repository navigation
Tauri 2 host prototype (WKWebView / WebView2) - #23
Closed
DominikPalo wants to merge 1 commit into
Closed
DominikPalo wants to merge 1 commit into
DominikPalo wants to merge 1 commit into
Conversation
Hosts the unchanged renderer in Tauri next to the Electron build: - src-tauri: Rust ports of main/files.ts (allow-list, atomic writes, .bak), main/store.ts, the close handshake, single instance, file associations and macOS open-document events; AppKit calls for the title-bar document and recent documents. - hostTauri.ts implements HostApi over invoke/listen with raw binary IPC for file bytes; tauriMenu.ts builds the native menu from shared/commands.ts. - HostKind gains 'tauri'; optional HostApi.onFileDrag drives the drop overlay because Tauri takes OS drops away from the page. Release bundle on macOS arm64: 4.1 MB .app / 2.6 MB DMG (Electron: 128 MB). Windows is untested; see src-tauri/README.md for verified flows and gaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A prototype that hosts the unchanged renderer in Tauri 2 (system WKWebView on macOS, WebView2 on Windows) next to the existing Electron build. It is meant to show what dropping Electron would cost and gain. Nothing in
src/coreor the React UI was rewritten.Headline: the macOS arm64 release bundle is 4.1 MB (.app) / 2.6 MB (DMG), against 128 MB for the Electron 0.3.0 DMG.
What changed
src-tauri/(new): the Rust host, a port ofsrc/main+src/preload.files.rs: the allowlist of user-picked / dropped / remembered paths, atomic writes (temp file + rename, file mode kept, optional.bak), per-file write serialization.store.rs: the same JSON key/value store.main.rs: dialogs, the close handshake, single instance, command-line / Finder "open document" handling, drag-drop paths.macos.rs: title-bar document and edited dot, Recent Items (AppKit viaobjc2).tauri.conf.json: window, bundle, and the same file associations aselectron-builder.yml.hostTauri.tsimplementsHostApiwithinvoke/listen. File bytes go both ways as raw binary (ipc::Response/ raw body + percent-encoded path header), never as JSON number arrays.tauriMenu.tsbuilds the native menu fromshared/commands.ts, the same source as the Electron menu.HostKindgains'tauri', and the Reveal buttons now checkhost.kind !== 'web'.HostApi.onFileDrag: Tauri takes OS file drops away from the page (no HTML5drop), so this drives the drop overlay.data-tauri-drag-regionon the tab bar on macOS.tests/tauri-config.test.tskeeps the Rust extension list and file associations in sync withshared/api.ts/electron-builder.yml.npm run dev:tauri,npm run dist:tauri. Building needs a Rust toolchain.Security note
Dialogs run in Rust, so only paths the user actually picked, dropped or opened before are approved. Unlike the Electron build, the renderer cannot approve paths itself:
approvePathsis a no-op, and dropped paths are approved on the native side.Verified on macOS (Apple Silicon)
npm test,npm run typecheck,cargo clippy(clean), andnpm run e2estill passes against Electron.openinto the running instance, session restore..bakidentical to the original, file mode kept, path with spaces, valid ZIP. The edited dot toggles.Not done / reviewer notes
_electroncan't drive it andtauri-driverhas no macOS support. Screenshots and the demo stay on Electron.@tauri-apps/apiis pinned to~2.11to match thetauricrate. The CLI refuses mismatched minors.mainbefore the Save button work (Add Save and Save As buttons to the tab bar #22). It merges cleanly.Full details are in
src-tauri/README.md.🤖 Generated with Claude Code