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
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:
wyn build app.wyn && ./appAPI
| Method | Description |
|---|---|
App.create(title, width, height) -> int | Create 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
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
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
| Platform | Backend | Status |
|---|---|---|
| macOS | WebKit (WKWebView) | ✅ Working |
| Linux | WebKitGTK | Planned |
| Windows | Edge WebView2 | Planned |
See Also
- Gui (SDL2) - lower-level graphics
- Color - color manipulation
- Showcase - desktop apps built with Wyn