desktop module

Guides: Architecture · Platform APIs. Available as @import("desktop") in desktop scaffolds.

Window

ExportSignature
Window.init(allocator, WindowOptions) !Window
WindowOptions{ title, width = 1024, height = 768, devtools = false, scheme = "verve", initial_path = "index.html", assets: []const AssetEntry, dev_assets: ?DevAssetsConfig, install_default_menu = true, on_message/on_url_open/on_drag_drop/on_resize/on_focus/on_close (+ctx ptrs) }
Methodsrun deinit setTitle loadUrl loadHtml evalJs setMessageHandler openChildWindow cookies() clipboard() print printWithOptions snapshot deliverUrl setColorSchemeHandler setUrlOpenHandler

Handlers: MessageHandler (ctx, payload) · UrlOpenHandler · DragDropHandler (paths) · ResizeHandler (w, h) · FocusHandler (bool) · CloseHandler → bool (return true to allow close).

IPC

Router(Ctx, Routes) — comptime route table; each pub const route = struct { Args, Reply, handle(ctx, alloc, args) !Reply }. JS: window.verve.request({type, …}) / .send(json) / .onMessage(fn).

Assets

AssetEntry{ path, bytes, content_type } · asset_router.resolve(entries, path) · resolveWithFallback(alloc, io, entries, path, dev_dir) — dev disk overrides embedded; path traversal rejected.

Capability modules

ModuleKey APIPlatform notes
trayinit(alloc, window, TrayOptions) !Tray; setTooltip/setIcon/setMenu, click + menu handlersLinux needs libayatana-appindicator3; GTK4 unsupported
notificationsshow(alloc, .{ .title, .body })macOS needs signed bundle
hotkeysinit(alloc, cb, ctx) !Manager; register(id, Modifiers, keycode)Wayland unsupported; Linux fires off worker thread
deep_linkforwardToRunningInstance startListener registerSchememacOS warm-launch is system-handled
single_instanceacquire(alloc, name) !Lock (error.AlreadyRunning)flock / CreateMutexW
clipboardvia window.clipboard(): text/HTML/PNG read+writeLinux text-only
cookiesvia window.cookies(): get/set/delete/clear with Cookie{ same_site, http_only, … }
fswatchinit(alloc, path, cb, ctx) !WatchermacOS recursive ~1s batches; Windows recursive worker-thread; Linux non-recursive
autostartenable/disable/isEnabled(alloc, io, environ, …)LaunchAgents / HKCU Run / .desktop
updatescheckForUpdate(alloc, feed_url, version) !?UpdateInfo; applyUpdate (sha256-verified)Linux unsupported
powerbatteryPercent() ?u32 isCharging() bool
displayslist(alloc) ![]Display{ x, y, width, height, scale, primary }

Dialogs & output

FileDialogOptions (open/save/multi/directory), AlertOptions{ buttons, style: informational|warning|critical }, PrintOptions{ kind: default|browser|system, copies, pages, printer_name }, window snapshot (GTK4 unsupported).

All modules use explicit error sets with error.Unsupported where a platform can't deliver — no silent fallbacks.