Gio implements portable immediate mode GUI programs in Go. Gio programs run on all the major platforms: iOS/tvOS, Android, Linux (Wayland/X11), macOS, Windows, FreeBSD, OpenBSD, and experimental support for browsers (Webassembly/WebGL). There is a unikernel port for running Gio programs in virtual machines.
Gio includes an efficient vector renderer based on the Pathfinder project (https://github.com/servo/pathfinder), implemented on OpenGL ES and Direct3D 11. Text and other shapes are rendered using only their outlines without baking them into texture images, to support efficient animations, transformed drawing and pixel resolution independence.
This is a screenshot of the Kitchen example. If your browser supports WebAssembly and WebGL, run the example by pressing the run button.
The architecture document is a good introduction to Gio concepts and API.
The examples give a feel of the structure of typical Gio programs.
The “Immediate Mode GUI Programming” article compares Gio’s immediate mode design with the traditional retained mode APIs such as the browser DOM.
The layout package implements useful layouts, while the widget and widget/material packages implement common user interface widgets. The gesture package detects common gestures from lower-level input events.
Layouts, widgets and gestures are all implemented in terms of operations.
Gio is designed to work with very few dependencies. It depends only on the platform libraries for window management, input and GPU drawing.
Gio supports the latest released version of Go in module mode. Earlier versions of Go and GOPATH mode might work, but no effort is made to keep them working.
Running Gio programs
go tool to initialize a new module and run the “hello”
$ go mod init example.com $ go run gioui.org/example/hello
should display a simple message in a window.
$ go run gioui.org/example/kitchen
is another example that demonstrates the material design widgets.
Running on mobiles
For Android, iOS, tvOS the
gogio tool can build and package a Gio program for you.
To build an Android .apk file from the
$ go run gioui.org/cmd/gogio -target android gioui.org/example/kitchen
To build for the iOS simulator:
$ go run gioui.org/cmd/gogio -target ios -appid <bundle-id> gioui.org/example/gophers
See the running on mobile page for more information.
To run a Gio program in a compatible browser, the
gogio tool can output a directory ready to
serve. With the
goxec tool you don’t even need a web server:
$ go run gioui.org/cmd/gogio -target js gioui.org/example/gophers $ go get github.com/shurcooL/goexec $ goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir("gophers")))'
Open http://localhost:8080 in a browser to run the program.
Integration with existing projects
See the integration guide for details on using Gio with existing projects.
Programs using Gio
- Scatter, an implementation of the Signal protocol over email.
- godcr, a cross-platform desktop wallet for the Decred cryptocurrency.
- sprig, a client for the Arbor chat system.
- Immediate Mode GUI Programming
- Gophercon 2019 talk about Gio and Scatter. Slides, Demos.
- Gophercon UK 2019 talk demonstrating a Gio program built from scratch. Slides, Demos.
- Community Calls
The source code, mailing lists and issue tracker for Gio are hosted on sourcehut.
File bugs and TODOs through the issue tracker or send an email to ~email@example.com. For general discussion, use the ~firstname.lastname@example.org mailing list or the #gioui Gophers Slack channel.
Post patches to the gio-patches list. No Sourcehut account is required and you can post without being subscribed.
You can also use the Sourcehut web-based flow for submitting patches, similar to other source forges. See the contribution guide for more details.
Gio’s main developer is working full-time on Gio, 100% supported by sponsorships. Please consider sponsoring Gio if you find it useful. Sponsorships are handled by GitHub Sponsors and are easy to set up.
Bitcoin donations are gladly accepted to bc1q8xw95urett00f4xs3v66p2l6xp2mfk5erpe5ug. Donations will go toward hosting expenses and for supporting the author’s full time work on Gio.