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

Overview

⚛️ Positron

project logo

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

Usage

//! src/minimal.zig

const std = @import("std");
const wv = @import("positron");

pub fn main() !void {
    const view = try wv.View.create(false, null);
    defer view.destroy();

    view.setTitle("Webview Example");
    view.setSize(480, 320, .none);

    view.navigate("https://ziglang.org");
    view.run();
}
//! build.zig

const std = @import("std");
const pkgs = @import(".zpm/pkgs.zig");
const Sdk = @import("Sdk.zig");

pub fn build(b: *std.build.Builder) void {
    const target = b.standardTargetOptions(.{});
    const mode = b.standardReleaseOptions();

    const exe = 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.

You might also like...
An Sqlite3 Elixir library

Exqlite An SQLite3 library with an Ecto adapter implementation. Caveats When using the Ecto adapter, all prepared statements are cached using an LRU c

✔️The smallest header-only GUI library(4 KLOC) for all platforms
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

StereoKit is an easy-to-use open source mixed reality library for building HoloLens and VR applications with C# and OpenXR!
StereoKit is an easy-to-use open source mixed reality library for building HoloLens and VR applications with C# and OpenXR!

StereoKit is an easy-to-use open source mixed reality library for building HoloLens and VR applications with C# and OpenXR! Inspired by libraries like XNA and Processing, StereoKit is meant to be fun to use and easy to develop with, yet still quite capable of creating professional and business ready software.

Zig library to connect Janet and Zig together

Jzignet Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. Janet is a functional and

C code that make nice posters
C code that make nice posters

ProgrammingPosters C that that make nice posters of short C programs. This generates A2 300D DPI images of programs that implement intresting graphics

A Sol-inspired minimalist Lua binding for Zig.
A Sol-inspired minimalist Lua binding for Zig.

zoltan A Sol-inspired minimalist Lua binding for Zig. Features Supports Zig 0.9.0 Lua tables table creation from Zig get/set/create methods possible k

An HTML5 parsing library in pure C99

Gumbo - A pure-C HTML5 parser. Gumbo is an implementation of the HTML5 parsing algorithm implemented as a pure C99 library with no outside dependencie

How to use Live Update to improve the load speed of HTML5 game.

ResZip: use Live Update to improve load speed of HTML5 game In short, HTML5 games should load as fast as possible! Why - https://vimeo.com/350139974

Mixed reality VR laser tag using Oculus Quest 2 and OAK-D depth cameras. First prize winner for North America region in OpenCV AI Competition 2021.
Mixed reality VR laser tag using Oculus Quest 2 and OAK-D depth cameras. First prize winner for North America region in OpenCV AI Competition 2021.

Mixed Reality Laser Tag Copyright 2021 Bart Trzynadlowski Overview This is the source code to my Mixed Reality Laser Tag project, which won first priz

This repository contains the source code of the project(StereoCraft) that we have developed for the Mixed Reality Hackathon organized by Microsoft using StereoKit SDK

StereoCraft - A block-building like experience built using StereoKit This repository contains the source code of the project that we have developed fo

A simple library that helps Android developers to execute JavaScript code from Android native side easily without using Webview.

AndroidJSModule A simple library that helps Android developers to execute JavaScript code from Android native side easily without using Webview. Insta

A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs.

webview for golang and c/c++ A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. The goal of the project is to

Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Nim bindings, Haskell, C# bindings and Java bindings available.

Ultra-lightweight web browser based on Qt Ultralight webview, powered by Ultralight HTML renderer
Ultra-lightweight web browser based on Qt Ultralight webview, powered by Ultralight HTML renderer

Qt Ultralight Browser This is an ultra-lightweight web browser powered by the Ultralight web engine embedded in Qt 5 app as a custom webview widget -

A WebView2-powered Flutter WebView implementation for the Windows platform.
A WebView2-powered Flutter WebView implementation for the Windows platform.

A Flutter WebView plugin for Windows built on Microsoft Edge WebView2.

Make screenshot every few minutes to make your small history!

Screenlapse Fun CPP application (which isn't well-made, can be optimized) that automatically make screenshots of your screen every few minutes and sto

A single header C++ wasm frontend library leveraging Emscripten
A single header C++ wasm frontend library leveraging Emscripten

Livid Livid is a single header C++ wasm frontend library leveraging Emscripten. Usage The code looks something like this: #include "livid/livid.hpp" #

This game is a nice pinball.

PelotaPlayaPinball Description This game is a nice pinball. Key Features 1 player Control with the keyboard Controls Keyboard Left and Right - Movemen

This is some utility functions/classes for having a nice way to communicate with a pico board RP2040

PicoScreenTerminal This is some utility functions/classes for having a nice way to communicate with a pico board RP2040 How to build First follow the

Comments
  • Feature Request: Hide/Unhide window

    Feature Request: Hide/Unhide window

    Hi, I would like to submit a feature request for hiding and un-hiding the webview window (not exiting it). If possible, it would also be cool to be able to hide the status/title bar on top and have functions to minimize/maximize the window which would allow for a custom title bar made in HTML.

    Awesome library, btw!

    enhancement 
    opened by theseyan 2
  • Statically linked Webview2Loader on Windows

    Statically linked Webview2Loader on Windows

    By default, the program on Windows will not run unless we copy over WebView2Loader.dll from /vendor/Microsoft.Web.WebView2.1.0.902.49/build/native/{arch} into the directory containing the executable. I think it's much better to statically link the loader (/vendor/Microsoft.Web.WebView2.1.0.902.49/build/native/{arch}/WebView2LoaderStatic.lib) to produce a single binary which makes it way easier to deploy and distribute. (I tried to link the static library but failed with a libuuid.a missing error) Is it possible to do so?

    opened by theseyan 0
Owner
ZigLibs
Community-driven library development
ZigLibs
wwasm (Wgmlgz wasm) - is a c++ & reactjs liblary for connecting c++ backend and reactjs frontend.

WWASM (Wgmlgz wasm) - is a c++ & reactjs liblary for connecting c++ backend and reactjs frontend.

null 1 Nov 23, 2021
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.9k Nov 19, 2022
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Restbed Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP

Corvusoft 1.7k Nov 22, 2022
C++ application development framework, to help developers create and deploy applications quickly and simply

ULib - C++ library Travis CI: Coverity Scan: ULib is a highly optimized class framework for writing C++ applications. I wrote this framework as my too

stefano casazza 949 Nov 22, 2022
Tntnet is a web application server for web applications written in C++.

Tntnet is a web application server for web applications written in C++.

Tommi Mäkitalo 73 Sep 26, 2022
Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++

libasyncd Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++. What is libasyncd? Libasyncd is an embeddable event-driven asynch

Seungyoung 165 May 25, 2022
Support for multiple RPC protocols in a single library

AnyRPC A multiprotocol remote procedure call system for C++ Overview AnyRPC provides a common system to work with a number of different remote procedu

Steve Gieseking 56 Nov 17, 2022
Pion Network Library (Boost licensed open source)

Pion Network Library C++ framework for building lightweight HTTP interfaces Project Home: https://github.com/splunk/pion Retrieving the code git clone

Splunk GitHub 293 Nov 17, 2022
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 695 Oct 12, 2022
bittyhttp - A threaded HTTP library for building REST services in C.

bittyhttp - A threaded HTTP library for building REST services in C.

Colin Luoma 12 Nov 29, 2021