Skip to content

Repository files navigation

⚛️ Positron

project logo

A Zig binding to the webview library. Make Zig applications with a nice HTML5 frontend a reality!

Usage

//! src/minimal.zigconststd=@import("std");
constwv=@import("positron");
pubfnmain() !void {
constview=trywv.View.create(false, null);
deferview.destroy();
view.setTitle("Webview Example");
view.setSize(480, 320, .none);
view.navigate("https://ziglang.org");
view.run();
}
//! build.zigconststd=@import("std");
constpkgs=@import(".zpm/pkgs.zig");
constSdk=@import("Sdk.zig");
pubfnbuild(b: *std.build.Builder) void {
consttarget=b.standardTargetOptions(.{});
constmode=b.standardReleaseOptions();
constexe=b.addExecutable("demo", "src/minimal.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
// Add and link the package.exe.addPackage(Sdk.getPackage("positron"));
Sdk.linkPositron(exe, null);
exe.install();
}

Example

The example is a small, two-view chat application that transfers data bidirectionally between backend and frontend.

Log in with ziggy/love and you can send messages, no real server there though!

You can build the example with zig build and run it with zig build run.

Building

Linux

Install gtk-3 and webkit2gtk, then invoke zig build.

Windows

Download Edge Dev Channel, then invoke zig build.

MacOS

No research was done for the support on MacOS. Try with zig build.

Contributing

This library is in a early state and is very WIP. Still, feel free to contribute with PRs, or use it. Just don't assume a stable API.

About

A web renderer frontend for zig applications

Resources

Stars

126 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages