# webkitgtk **Repository Path**: rocket049/webkitgtk ## Basic Information - **Project Name**: webkitgtk - **Description**: 这个东西真的牛,把 go 程序的界面交给网页,用 webkitgtk 运行 react 开发的前端做界面,集成 go 强大的后端开发能力。 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: https://github.com/malivvan/webkitgtk - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-13 - **Last Updated**: 2025-06-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # webkitgtk [](https://pkg.go.dev/github.com/malivvan/webkitgtk) [](https://github.com/malivvan/webkitgtk/releases/latest) [](https://goreportcard.com/report/github.com/malivvan/webkitgtk) [](LICENSE) Pure Go WebKitGTK binding for **Linux** and **FreeBSD**. > This is pre release software so expect bugs and potentially API breaking changes > but each release will be tagged to avoid breaking people's code. ## Installation ```sh # go 1.21.5+ go get github.com/malivvan/webkitgtk@latest ``` ## Example The following example shows how to create a simple GTK window with a button that closes the application when clicked. ```go package main import ui "github.com/malivvan/webkitgtk" type API struct { app *ui.App } func (a *API) Quit() error { a.app.Quit() return nil } func main() { app := ui.New(ui.AppOptions{ Name: "example", }) app.Open(ui.WindowOptions{ Title: "example", HTML: ``, Define: map[string]interface{}{ "app": &API{app: app}, }, }) if err := app.Run(); err != nil { panic(err) } } ``` ## Running / Building Running / building defaults to debug mode outputting logs to stderr. To build in release mode use the `release` build tag. ```sh go build -tags release -ldflags "-s -w" -trimpath ``` The resulting release binary will be about ~6MB in size and cam be compressed further with [UPX](https://upx.github.io/) to about ~2.5MB. ## Examples - [echo](examples/echo/echo.go) - call go functions from javascript - [dialog](examples/dialog/dialog.go) - application spawning different types of dialog windows - [handle](examples/handle/handle.go) - handle requests on the app:// uri scheme to serve embedded files - [notify](examples/notify/notify.go) - application sending different types of notifications - [systray](examples/systray/systray.go) - example application showing how to use the systray ## Dependencies Either [`webkit2gtk-4.1`](https://pkgs.org/search/?q=webkit2gtk-4.1&on=name) ([*stable*](https://webkitgtk.org/reference/webkit2gtk/stable/)) or [`webkitgtk-6.0`](https://pkgs.org/search/?q=webkitgtk-6.0&on=name) ([*unstable*](https://webkitgtk.org/reference/webkitgtk/unstable/index.html)) is required at runtime. If both are installed the stable version will be used.
Debian / Ubuntu | apt install libwebkit2gtk-4.1 |
apt install libwebkitgtk-6.0 |
RHEL / Fedora | dnf install webkitgtk4 |
dnf install webkitgtk3 |
Arch | pacman -S webkit2gtk-4.1 |
pacman -S webkitgtk-6.0 |
Alpine | apk add webkit2gtk |
apk add webkit2gtk-6.0 |
Gentoo | emerge -av net-libs/webkit-gtk |
|
FreeBSD | pkg install webkit2-gtk3 |
pkg install webkit2-gtk4 |