Guidelines for humans and coding agents working in this repository.
Hex package :desktop_webview: native desktop webview hosts plus an Elixir
backend that implements Desktop.Platform.* for elixir-desktop.
Apps keep using Desktop.Window / Desktop.Menu. They select this backend with:
config :desktop, :backend, DesktopWebview.Backend
config :desktop, :menu_adapter, DesktopWebview.Menu.Adapter| Path | Purpose |
|---|---|
lib/desktop_webview/ |
Elixir transport, launcher, backend, menu adapter |
native/macos/ |
Swift + AppKit + WKWebView host (primary) |
native/windows/ |
WebView2 host (scaffold until implemented) |
native/linux/ |
WebKitGTK host (scaffold until implemented) |
docs/ |
Protocol, packaging, porting, integration, per-platform status |
test/ |
Unit + Elixir E2E (drives the native binary) |
priv/native/ |
Vendored macOS universal binary (CI-produced) |
- Do not call
:wx*from this package. All UI goes through JSON-RPC to the native host. - Do not teach
Desktop.Windowabout WKWebView. Integrate only viaDesktop.Platformbehaviours. - Host flags use
--edw-*. Strip them before forwarding argv to BEAM. - Native always listens; Elixir always connects (prod and dev).
- No native unit-test frameworks (no XCTest, etc.) as the source of truth. Extend the shared Elixir E2E suite instead. Test-only RPC (
test.*) is allowed when gated by--edw-test-rpc. - Status matrices are authoritative. Mark a feature
doneon a platform only when Elixir E2E covers it. - Per-platform native code stays isolated. Do not share Swift/C++/GTK UI code across
native/*until a deliberate shared core exists.
Wire format, method names, and behavioral semantics live in docs/protocol.md.
Change the doc and both sides (Elixir + native) together. Production methods must
not depend on test.* methods.
New platform hosts follow docs/porting.md and may only mark status rows done
when Elixir E2E covers them.
- Packaged: host starts, binds TCP, spawns BEAM from default
.app/ ini layout. - Dev: Elixir launches the binary with
--edw-no-beam, readslistening <port>from stdout, connects. - Lifetime default: host survives BEAM disconnect (reconnect). Opt-in
--edw-lifetime=coupled.
Menu adapter selection for third-party backends requires hooks in elixir-desktop/desktop
(config :desktop, :menu_adapter, ...). Keep those changes minimal and documented in
docs/desktop-integration.md.