{"id":14990793,"url":"https://github.com/thechampagne/webview-zig","last_synced_at":"2026-03-05T23:42:59.454Z","repository":{"id":192073255,"uuid":"685986445","full_name":"thechampagne/webview-zig","owner":"thechampagne","description":"⚡ Zig binding \u0026 wrapper for a tiny cross-platform webview library to build modern cross-platform GUIs.","archived":false,"fork":false,"pushed_at":"2025-03-16T02:18:36.000Z","size":276,"stargazers_count":108,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T00:05:27.514Z","etag":null,"topics":["library","webview","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thechampagne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-01T13:17:15.000Z","updated_at":"2025-03-17T04:53:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"af78f98a-aaf3-4536-836f-109b77879ba6","html_url":"https://github.com/thechampagne/webview-zig","commit_stats":{"total_commits":85,"total_committers":6,"mean_commits":"14.166666666666666","dds":"0.12941176470588234","last_synced_commit":"543fdfbc66a1acfc1243c1f6e096b2d74a04f5ac"},"previous_names":["thechampagne/webview-zig"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thechampagne%2Fwebview-zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thechampagne%2Fwebview-zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thechampagne%2Fwebview-zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thechampagne%2Fwebview-zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thechampagne","download_url":"https://codeload.github.com/thechampagne/webview-zig/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419859,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","webview","zig","zig-package","ziglang"],"created_at":"2024-09-24T14:20:51.765Z","updated_at":"2026-03-05T23:42:54.425Z","avatar_url":"https://github.com/thechampagne.png","language":"Zig","funding_links":[],"categories":["Zig"],"sub_categories":[],"readme":"# webview-zig\n\n[![](https://img.shields.io/github/v/tag/thechampagne/webview-zig?label=version)](https://github.com/thechampagne/webview-zig/releases/latest) [![](https://img.shields.io/github/license/thechampagne/webview-zig)](https://github.com/thechampagne/webview-zig/blob/main/LICENSE)\n\nZig binding for a tiny cross-platform **webview** library to build modern cross-platform GUIs.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/thechampagne/webview-zig/main/.github/assets/screenshot.png\"/\u003e\n\u003c/p\u003e\n\n### Requirements\n - [Zig Compiler](https://ziglang.org/) - **0.13.0**\n - Unix\n   - [GTK3](https://gtk.org/) and [WebKitGTK](https://webkitgtk.org/)\n - Windows\n   - [WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)\n - macOS\n   - [WebKit](https://webkit.org/)\n\n### Usage\n\n```\nzig fetch --save https://github.com/thechampagne/webview-zig/archive/refs/heads/main.tar.gz\n```\n\n`build.zig.zon`:\n```zig\n.{\n    .dependencies = .{\n        .webview = .{\n            .url = \"https://github.com/thechampagne/webview-zig/archive/refs/heads/main.tar.gz\" ,\n          //.hash = \"12208586373679a455aa8ef874112c93c1613196f60137878d90ce9d2ae8fb9cd511\",\n        },\n    },\n}\n```\n`build.zig`:\n```zig\nconst webview = b.dependency(\"webview\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"webview\", webview.module(\"webview\"));\nexe.linkLibrary(webview.artifact(\"webviewStatic\")); // or \"webviewShared\" for shared library\n// exe.linkSystemLibrary(\"webview\"); to link with installed prebuilt library without building\n```\n\n### API\n\n```zig\nconst WebView = struct {\n\n    const WebViewVersionInfo = struct {\n        version: struct {\n            major: c_uint,\n            minor: c_uint,\n            patch: c_uint,\n        },\n        version_number: [32]c_char,\n        pre_release: [48]c_char,\n        build_metadata: [48]c_char,\n    };\n\n    const DispatchCallback = *const fn (WebView, ?*anyopaque) void;\n\n    const BindCallback = *const fn ([:0]const u8, [:0]const u8, ?*anyopaque) void;\n\n    const WindowSizeHint = enum(c_uint) {\n        None,\n        Min,\n        Max,\n        Fixed\n    };\n\n    const NativeHandle = enum(c_uint) {\n        ui_window,\n        ui_widget,\n        browser_controller\n    };\n\n    const WebViewError = error {\n        MissingDependency,\n        Canceled,\n        InvalidState,\n        InvalidArgument,\n        Unspecified,\n        Duplicate,\n        NotFound,\n    };\n\n    fn CallbackContext(func: [DispatchCallback|BindCallback]) type {\n        return struct {\n            fn init(data: ?*anyopaque) @This();\n        };\n    }\n\n    fn create(debug: bool, window: ?*anyopaque) WebView;\n\n    fn run(self: WebView) WebViewError!void;\n\n    fn terminate(self: WebView) WebViewError!void;\n    \n    fn dispatch(self: WebView, ctx: *const CallbackContext) WebViewError!void;\n    \n    fn getWindow(self: WebView) ?*anyopaque;\n\n    fn getNativeHandle(self: WebView, kind: NativeHandle) ?*anyopaque;\n    \n    fn setTitle(self: WebView, title: [:0]const u8) WebViewError!void;\n    \n    fn setSize(self: WebView, width: i32, height: i32, hint: WindowSizeHint) WebViewError!void;\n    \n    fn navigate(self: WebView, url: [:0]const u8) WebViewError!void;\n    \n    fn setHtml(self: WebView, html: [:0]const u8) WebViewError!void;\n    \n    fn init(self: WebView, js: [:0]const u8) WebViewError!void;\n    \n    fn eval(self: WebView, js: [:0]const u8) WebViewError!void;\n    \n    fn bind(self: WebView, name: [:0]const u8, ctx: *const CallbackContext) WebViewError!void;\n    \n    fn unbind(self: WebView, name: [:0]const u8) WebViewError!void;\n    \n    fn ret(self: WebView ,seq: [:0]const u8, status: i32, result: [:0]const u8) WebViewError!void;\n    \n    fn version() *const WebViewVersionInfo;\n\n    fn destroy(self: WebView) WebViewError!void;\n}\n```\n\n### References\n - [webview](https://github.com/webview/webview/tree/0.12.0) - **0.12.0**\n\n### License\n\nThis repo is released under the [MIT License](https://github.com/thechampagne/webview-zig/blob/main/LICENSE).\n\nThird party code:\n - [external/WebView2](https://github.com/thechampagne/webview-zig/tree/main/external/WebView2) licensed under the [BSD-3-Clause License](https://github.com/thechampagne/webview-zig/tree/main/external/WebView2/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthechampagne%2Fwebview-zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthechampagne%2Fwebview-zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthechampagne%2Fwebview-zig/lists"}