Skip to content

App (Desktop GUI)

Build desktop apps with HTML, CSS, and system fonts. Uses the native OS webview (WebKit on macOS, WebKitGTK on Linux, Edge WebView2 on Windows).

No Electron. No browser. Just a native window with a webview. Your binary stays small.

Not usable from a released build (as of v1.21.0)

App.* needs src/wyn_webview.o, which the release tarballs do not ship, so every example on this page fails at the linker with no such file or directory: .../src/wyn_webview.o. It works only from a source checkout. This is a packaging bug, not an API change, and it is filed. Nothing here is safe to build on until a release includes that object.

Unrelated and does work on a released build: wyn build --app, which bundles any program into a double-clickable application.

Quick Start

wyn
fn main() {
    App.create("My App", 800, 600)
    App.html("<h1>Hello from Wyn!</h1><p>System fonts. CSS styling.</p>")
    App.run()
    App.destroy()
}

Build and run:

bash
wyn build app.wyn && ./app

API

MethodDescription
App.create(title, width, height) -> intCreate a native window with webview
App.html(content)Set HTML content
App.url(url)Navigate to a URL
App.eval(js)Execute JavaScript in the webview
App.set_title(title)Change window title
App.run()Run the event loop (blocking)
App.destroy()Close the window

Examples

Text Editor

wyn
fn main() {
    App.create("Editor", 900, 650)
    App.html("<textarea style='width:100%;height:100vh;font-family:monospace;font-size:14px;background:#1e1e2e;color:#cdd6f4;border:none;padding:16px'></textarea>")
    App.run()
}

Dashboard with Live Data

wyn
fn main() {
    cpu = System.exec("...").trim()
    App.create("Dashboard", 800, 500)
    App.html("<h1>CPU: " + cpu + "%</h1>")
    App.run()
}

How It Works

App.create opens a native OS window containing a webview. On macOS, this is WKWebView (the same engine Safari uses). Your HTML/CSS/JS runs in the webview with full access to system fonts, CSS animations, flexbox, grid - everything a modern browser supports.

The Wyn binary handles the backend logic. The webview handles the UI. No runtime to install, no browser to bundle - the system webview is already there.

Platform Support

PlatformBackendStatus
macOSWebKit (WKWebView)✅ Working
LinuxWebKitGTKPlanned
WindowsEdge WebView2Planned

See Also

MIT License - v1.21.0