puregotk-webkit

command module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 7 Imported by: 0

README

puregotk-webkit

WebKitGTK 6 bindings for Go, built on top of puregotk.

Credits

This project is entirely based on the work of @jwijenbergh and their excellent puregotk library. The code generator, type system, and template engine are all from puregotk - this repository simply extends it to generate bindings for WebKitGTK 6.

All credit for the core implementation goes to the original author.

What is this?

Autogenerated WebKitGTK 6 bindings for Go leveraging purego - no Cgo required.

This package provides bindings for:

  • WebKit 6.0 - WebKitGTK web views, settings, and web content rendering
  • JavaScriptCore 6.0 - JavaScript engine bindings
  • Soup 3.0 - HTTP client/server library
  • WebKitWebProcessExtension 6.0 - Web process extensions

NOTE: This library is experimental. Some APIs might be incorrectly exposed.

Advantages

No Cgo needed, thus:

  • Easy cross compilation
  • No C toolchain needed
  • Much faster compile times

Installation

go get github.com/bnema/puregotk-webkit

Requires puregotk as a dependency.

Basic Example

package main

import (
	"os"

	"github.com/jwijenbergh/puregotk/v4/gio"
	"github.com/jwijenbergh/puregotk/v4/gtk"
	"github.com/bnema/puregotk-webkit/webkit"
)

func main() {
	app := gtk.NewApplication("com.example.webview", gio.GApplicationFlagsNoneValue)
	defer app.Unref()

	actcb := func(_ gio.Application) {
		activate(app)
	}
	app.ConnectActivate(&actcb)

	if code := app.Run(len(os.Args), os.Args); code > 0 {
		os.Exit(code)
	}
}

func activate(app *gtk.Application) {
	window := gtk.NewApplicationWindow(app)
	window.SetTitle("WebKit Example")
	window.SetDefaultSize(800, 600)

	webview := webkit.NewWebView()
	webkit.WebViewLoadUri(webview, "https://example.com")

	window.SetChild(&webview.Widget)
	window.Present()
}

Generating the Bindings

make all    # sync template, generate, build

Or step by step:

make sync      # fetch template from puregotk
make generate  # run go generate + goimports
make build     # build all packages

License

MIT

Acknowledgements

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package webkit was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package webkit was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package webkitwebprocessextension was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT
Package webkitwebprocessextension was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL