Skip to content

AI-native design editor. Open-source Figma alternative.

5.7 KB
Raw Blame

Desktop (Tauri v2)

Check desktop/Cargo.toml, desktop/capabilities/**, and desktop/tauri.conf.json before adding desktop capabilities. Release versions are also set in desktop/tauri.conf.json and desktop/Cargo.toml (tools/AGENTS.md, Releases).

  • File system and shell permissions must be configured explicitly; a vague "Internal error" save failure usually means a missing permission.
  • Dev tools: add or use a menu item to toggle them; do not rely on keyboard shortcuts.
  • desktop/src/credentials.rs stores secrets in the native system credential store; failures must surface, never fall back to browser or plaintext storage (src/AGENTS.md, Settings).
  • ACP and harness process changes require checking desktop/capabilities/**.
  • The fs scope allows documents anywhere but denies, in the global fs:scope, every place where a written file would run, and requireLiteralLeadingDot keeps hidden files out of ** on every platform; a new write path must not reopen either (tests/e2e/native/fs-scope.spec.ts). The app's own cache in $APPLOCALDATA is allowed by name, as on Linux it lives under ~/.local/share, which ** does not reach.
  • A shell:allow-spawn entry pins the whole command line: no "args": true, and a Windows .cmd shim runs through its own cmd-<name> entry with fixed /c <name> … arguments, which resolvePlatformCommand selects (tests/engine/tauri/command.test.ts).
  • The Software Update window is a second webview labelled updater that loads updater.html (src/updater.ts), never the editor's index.html; its own capability, desktop/capabilities/updater.json, grants only checking, installing, restarting, closing, and opening links. It owns no documents, so before a restart or a Windows install it asks the editor window over updater:restart-request to run the Quit approval (src/app/shell/updater/approvals.ts, tests/app/shell/updater/session.test.ts).
  • Never click Install in a tauri dev build: the updater unpacks the release next to the running binary, which there is desktop/target/debug.
  • desktop/generated/menu.json is produced by bun run generate:tauri-menu from src/app/shell/menu/schema.ts; do not edit or import it directly.
  • On Linux a menu item registers its accelerator natively only when it holds Ctrl, Alt, or Super and is not copy, cut, or paste: GTK runs window accelerators before the WebView sees the key, so plain and Shift-only keys stay with the frontend's shortcuts, which skip text fields (menu::tests in desktop/src/menu/mod.rs).
  • A menu or menu entry with a feature in the schema is built only while the frontend names that feature through set_native_menu_features (src/app/shell/menu/features.ts); document hides what needs an open document on Home and a New file tab. Every rebuild keeps the check states the menu had (desktop/src/menu/mod.rs).
  • Command items are greyed out while their editor command is unavailable: the frontend sends their ids through set_native_menu_disabled, which updates the items in place instead of rebuilding (src/app/shell/menu/editor.ts).
  • Run bun run generate:icons --target desktop before direct Cargo checks; native icons are generated, not committed.
  • build_fig_file performs full .fig export on desktop at the level it is given, on a blocking thread, since high levels take seconds; saves that patch an opened archive compress in the web worker (packages/fig/AGENTS.md).
  • The embedded WebDriver plugin compiles only with the native-test Cargo feature and must never be enabled in development or production binaries. Native tests use bun run test:native (tests/AGENTS.md).
  • The editor opens external links through the open_external_url command, which allows only http, https, and mailto; native-test builds record them for take_native_test_opened_urls instead of launching a browser. The main window is built in setup so window.open goes the same way (open_new_window_externally); the shell plugin's own link handler is kept out by src/app/shell/external-links.ts (system::opener unit tests, tests/e2e/native/cloud-links.spec.ts).
  • openpencil:// links are parsed in desktop/src/launch/links.rs and queued in desktop/src/launch/mod.rs: open queues files through take_pending_open, join queues validated room IDs through take_pending_rooms, cloud queues Cloud invitations and shared links (UUID, hex secret, http(s) server) through take_pending_cloud_links; second launches forward their link arguments through the single-instance handler (launch::links unit tests).
  • On Linux, run() sets __NV_DISABLE_EXPLICIT_SYNC=1 before the Tauri builder only on Wayland, with the NVIDIA driver loaded, under a WebKitGTK older than 2.54.2, and when the variable is unset: those versions commit a frame without an acquire point and the compositor disconnects the app (WebKit bug 324551). Do not add DMABUF or shared-memory overrides; they cost every NVIDIA user rendering speed for a crash this one avoids (explicit_sync unit tests).
  • SF Symbols are drawn by SwiftUI through the Swift package desktop/swift/sf-symbols, linked by build.rs on macOS; they are never bundled, served, or read from Apple's font files. sf_symbols_render stays a synchronous command so Tauri runs it on the main thread SwiftUI needs, and both commands answer null below macOS 14, which lacks the path operations that cut badge knockouts (packages/core/tests/icons/sf-symbols/provider.test.ts).
  • A panic hook installed in setup writes the last Rust panic to last-panic.json in the app data folder, and take_last_panic hands it to the next launch once, which offers it as a report in official builds; the hook calls the default hook first and never panics itself (desktop/src/system/crash.rs, src/app/reports/crash.ts).