Giter Club home page Giter Club logo

positron's Introduction

⚛️ 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.

positron's People

Contributors

coolaj86 avatar ikskuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

positron's Issues

Fail to build the project with zig 0.12.0 and 0.13.0

$ zig build
xxxx\build.zig:6:21: error: root struct of file 'std' has no member named 'build'
pub fn build(b: *std.build.Builder) void {
                 ~~~^~~~~~
xxx\zig\0.13.0\files\lib\std\std.zig:1:1: note: struct declared here
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
^~~
referenced by:
    runBuild__anon_8955xxx\zig\0.13.0\files\lib\std\Build.zig:2115:50
    main:xxx\zig\0.13.0\files\lib\compiler\build_runner.zig:301:29
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Outdated Zig Syntax

It seems Positron and some of its dependencies use outdated Zig syntax. Are there any plans to keep this repository updated with Zig master?

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!

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.