WebKitGTK 6 bindings for Go, built on top of puregotk.
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.
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.
No Cgo needed, thus:
- Easy cross compilation
- No C toolchain needed
- Much faster compile times
go get github.com/bnema/puregotk-webkitRequires puregotk as a dependency.
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()
}make all # sync template, generate, buildOr step by step:
make sync # fetch template from puregotk
make generate # run go generate + goimports
make build # build all packages- @jwijenbergh for puregotk - the foundation this project is built on
- Purego and the ebitengine team
- gotk4 for GIR type definitions
- WebKitGTK team