[ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

3,502 views
Skip to first unread message

ma...@eliasnaur.com

unread,
Mar 31, 2019, 9:16:44 AM3/31/19
to golang-nuts
Hi,
 
I'm very happy to announce the first public release of Gio, a project for writing portable, hardware accelerated, immediate mode GUI programs in Go.

If you have Go 1.12 installed,

    $ export GO111MODULE=on
    $ go run gioui.org/apps/hello

should display the proverbial hello world message. If not, please follow the setup guide at

https://gioui.org/

The setup guide describes how to run the gio programs on Android an iOS.

The command

    $ go run gioui.org/apps/gophers

runs a simple demo displaying Go contributors fetched from Github. Specify a github token with the -token flag if you run out of quota.

Gio programs run on all the major platforms: iOS/tvOS, Android, Linux (Wayland), macOS and Windows. The project is very much experimental; don't expect Gio to produce production ready programs and apps yet.

Gio only depends on the platform libraries for drawing and input and avoids the platform toolkits. Gio has an immediate mode design where no structure is imposed on the program, not even for the layout hierachy. Unlike any other Go project I know of, Gio runs on all the major platforms, mobile and desktop alike: iOS/tvOS, Android, macOS, Linux, Windows.

Gio includes an efficient vector renderer based on the Pathfinder project (https://github.com/pcwalton/pathfinder). Text and other shapes are rendered without baking them into texture images, to support efficient animations, transformed drawing and pixel resolution independence.

I decided to release Gio a little earlier than planned because of increasing activity in the Go GUI space. Fyne recently reached 1.0 and just two days ago Johann Freymuth released his ui library.
It is my ambition to make Go a natural choice for GUI programs everywhere. I hope you will be inspired to help me with Gio, but if you don't, Gio is dual licensed under MIT and the UNLICENSE, anyone is free to use Gio's code as their own, even without attribution. The gioui.org/ui/app package is particularly interesting; it abstracts window management, input and vector drawing into a simple Go API. The gioui.org/cmd/gio tool packages Gio programs into iOS/tvOS frameworks or Android AAR files.

The wide platform support is Gio's eye-catcher, but I'm most proud of its design. I've spent more than a year on the project and most of that time went into designing the API. However, this early release contains very little documentation (and no tests!); expect much more documentation in the coming months.

The project is hosted on Sourcehut (https://git.sr.ht/~eliasnaur/gio). Despite its very young age, I chose Sourcehut because it is strictly open source, its business model is simple and because it supports contributions without registration. The mailing list (https://lists.sr.ht/~eliasnaur/gio-dev) is open to everyone and patches are sent with git send-email. I expect that even bug reports (https://todo.sr.ht/~eliasnaur/gio) can be filed with an email in the future.

 - elias

Wojciech S. Czarnecki

unread,
Mar 31, 2019, 8:33:52 PM3/31/19
to golan...@googlegroups.com, ma...@eliasnaur.com
On Sun, 31 Mar 2019 06:16:43 -0700 (PDT)
ma...@eliasnaur.com wrote:

> Hi,
> I'm very happy to announce the first public release of Gio, a project for
> writing portable, hardware accelerated, immediate mode GUI programs in Go.

@elias_naur
Sounds interesting. **BUT**

[Quote from README.md in the repo]

> supply a Github token with the `-token` flag:
> $ go run gioui.org/apps/gophers -token <github token>

I will gladly translate "supply a Github token...":

"If you want to see my demo trust me and possibly give
me access to all your repositories hosted on github.
Remember to trust me!"

Because my code is not on github but sits somewhere in Philadelphia
datacenter bunker under domain registered on Haitan TLD by an unknown
European private person. Uph! At least https://gioui.org/ points to G cloud
216.239.32.0/19 network... but it then redirects to Quonix, Philly.

I recognize real Elias Naur name from this list and other places.
I do not recall him loudly going out of github, but I know real
Elias Naur still commits to the Go source tree and other github places.

So — regarding this announcement — I may assume that at best it might
be a kind of research in "password for chocolate"[1] style. But what if it is not?

I wish I was mistaken.

[1] https://www.sciencedaily.com/releases/2016/05/160512085123.htm


--
Wojciech S. Czarnecki
<< ^oo^ >> OHIR-RIPE

Raffaele Sena

unread,
Mar 31, 2019, 11:24:29 PM3/31/19
to Wojciech S. Czarnecki, golan...@googlegroups.com, ma...@eliasnaur.com
While I do find it odd that this project doesn't use github, because github requires an account, but SourceHut currently also requires to sign up for an account to submit issues or to submit to the mailing list, I don't think the fact that the demo asks for a GitHub token is really "nefarious".

The demo runs even without passing the token (you get a bunch of messages, but you also get some results) and looking at the code, the token is currently only used to authenticate the GitHub library in order to get extra capacity.

And I guess you can always fork the code clean up the nastiness :)

-- Raffaele

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Theophanes

unread,
Apr 1, 2019, 1:18:49 AM4/1/19
to golang-nuts
I don't typically run wayland anywhere, but I was interested in this project and installed wayland and weston from my package manager. However, it seems my package manager's version of weston (v4.0.0) is too old(?) because I get the Go error: "wayland: no xdg_wm_base available". Probably from [here](https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1051).

Do you have any tips?  Tried googling various terms, but nothing seemed relevant.

fresh.g...@gmail.com

unread,
Apr 1, 2019, 2:06:48 AM4/1/19
to golang-nuts
Hi Daniel,

Just for reference, I have Weston 6.0 and Goi runs just fine!

u@x1 ~> weston -v
Date: 2019-04-01 KST
[15:02:25.589] weston 6.0.0


And, thanks Elias for releasing Gio! It looks like a really interesting project and you've clearly put a lot of thought into designing the API and the interaction between various components. Wish you all the best in future adventures.

Happy coding!

Cheers,
Robin

ma...@eliasnaur.com

unread,
Apr 1, 2019, 3:15:49 AM4/1/19
to golang-nuts


On Monday, April 1, 2019 at 2:33:52 AM UTC+2, ohir wrote:
On Sun, 31 Mar 2019 06:16:43 -0700 (PDT)
ma...@eliasnaur.com wrote:

> Hi,  
> I'm very happy to announce the first public release of Gio, a project for
> writing portable, hardware accelerated, immediate mode GUI programs in Go.

@elias_naur
Sounds interesting. **BUT**

[Quote from README.md in the repo]

> supply a Github token with the `-token` flag:
> $ go run gioui.org/apps/gophers -token <github token>

I will gladly translate "supply a Github token...":

"If you want to see my demo trust me and possibly give
me access to all your repositories hosted on github.
Remember to trust me!"



Hi,

As I recall, github tokens don't have access to any of your data per default.
Regardless, definitely don't supply a token if you don't feel comfortable doing so;
the demo will run with the limited anonymous quota.

In the future I will add a demo that doesn't depend on GitHub and still shows something
interesting; the current demo was the extend of my imagination :)

 - elias

ma...@eliasnaur.com

unread,
Apr 1, 2019, 3:17:50 AM4/1/19
to golang-nuts


On Monday, April 1, 2019 at 5:24:29 AM UTC+2, Raffaele Sena wrote:
While I do find it odd that this project doesn't use github, because github requires an account, but SourceHut currently also requires to sign up for an account to submit issues or to submit to the mailing list, I don't think the fact that the demo asks for a GitHub token is really "nefarious".


The sourcehut mailing list is open to everyone and should not require an account. An account is required for issues, but that should change in the future.

  - elias

ma...@eliasnaur.com

unread,
Apr 3, 2019, 10:51:59 AM4/3/19
to golang-nuts


On Monday, April 1, 2019 at 7:18:49 AM UTC+2, Daniel Theophanes wrote:
I don't typically run wayland anywhere, but I was interested in this project and installed wayland and weston from my package manager. However, it seems my package manager's version of weston (v4.0.0) is too old(?) because I get the Go error: "wayland: no xdg_wm_base available". Probably from [here](https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1051).

Do you have any tips?  Tried googling various terms, but nothing seemed relevant.


I'm sorry I missed your question. The precursor "unstable" version of the "xdg_wm_base" is "zxdg_shell_v6", which is supported by weston but not by gio. However, weston is only a reference compositor and is not intended for serious use. On my Fedora 29, the Gnome shell supports xdg_wm_base, but its version of weston (5.0.0) does not.

What distribution and version are you running? If your distribution supports Wayland in general, you should be able to choose Wayland from the login chooser.

 - elias

Daniel Theophanes

unread,
Apr 3, 2019, 12:41:43 PM4/3/19
to golang-nuts
I'm running Deepin, debian based. Looking into the forums, the devs aren't interested in Wayland at the moment. [1] Though they are switching over the WM over to QT and kwin, so maybe in the future that will be an option.

I was only trying to run weston to try out gio. Thanks for the feedback, good to know.

dol...@gmail.com

unread,
Jun 5, 2019, 6:43:22 PM6/5/19
to golang-nuts
Him

Source Hut actually requires me to create an account to read the mailing list. Hmph.
Anyway, I tried to run it on android and web (don't have wayland), and they work!
It's just weird to interact within a canvas on the web and not get all the niceties of the classic html controls.
And on android, I can delete characters, but not input any (Samsung Galaxy S8, Android 9)

Elias Naur

unread,
Jun 6, 2019, 2:18:08 AM6/6/19
to golang-nuts


On Thursday, 6 June 2019 00:43:22 UTC+2, dol...@gmail.com wrote:
Him

Source Hut actually requires me to create an account to read the mailing list. Hmph.

That's surprising. I went to https://lists.sr.ht/~eliasnaur/gio-dev with a private browser session and it showed up fine. The "new post" link also worked fine (it's just a mailto: URL).
 
Anyway, I tried to run it on android and web (don't have wayland), and they work!
It's just weird to interact within a canvas on the web and not get all the niceties of the classic html controls.

Indeed. The webassembly/webgl port is intended for easy porting of an existing native app, not as a competitor to the web native controls.
 
And on android, I can delete characters, but not input any (Samsung Galaxy S8, Android 9)


Thanks for bringing it up, I've added it to the issue tracker: https://todo.sr.ht/~eliasnaur/gio/7. It's not entirely unexpected; I have only implemented the very basic parts of the Android and iOS text input interfaces.

 - elias

Elias Naur

unread,
Jun 11, 2019, 10:46:53 AM6/11/19
to golang-nuts
And on android, I can delete characters, but not input any (Samsung Galaxy S8, Android 9)


Thanks for bringing it up, I've added it to the issue tracker: https://todo.sr.ht/~eliasnaur/gio/7. It's not entirely unexpected; I have only implemented the very basic parts of the Android and iOS text input interfaces.


That issue should now be resolved. I don't have a Samsung phone myself, but the fix worked with the SwiftKey keyboard that had the same symptoms.

 - elias

Mark Bauermeister

unread,
Jun 14, 2019, 6:58:40 AM6/14/19
to golang-nuts
Any plans for a Vulkan back-end?

Elias Naur

unread,
Jun 14, 2019, 9:58:20 AM6/14/19
to golang-nuts


On Friday, June 14, 2019 at 12:58:40 PM UTC+2, Mark Bauermeister wrote:
Any plans for a Vulkan back-end?

When I'm happy with the OpenGL ES backend then yes, Vulkan is the logical next step.

 - elias

Nuclear Squid!!

unread,
Sep 4, 2019, 11:41:19 PM9/4/19
to golang-nuts
Hi, I wanted to try gio this week, and after a lot of work getting kde-plasma v5.14.3 working on Wayland (Funtoo x86_64), I now have hit the same issue here:


"wayland: no xdg_wm_base available"

I'm a newbie to Wayland -- what does this mean and what component needs upgrading?

Thanks,
-Russ

Elias Naur

unread,
Sep 5, 2019, 5:18:45 AM9/5/19
to Nuclear Squid!!, golang-nuts
>
> Hi, I wanted to try gio this week, and after a lot of work getting
> kde-plasma v5.14.3 working on Wayland (Funtoo x86_64), I now have hit the
> same issue here:
>
> https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1134
>
> "wayland: no xdg_wm_base available"
>
> I'm a newbie to Wayland -- what does this mean and what component needs
> upgrading?
>

I'm sorry that you had to go through all that work. If its any
consolation, there is progress on the X11 port over at
gioui.org/issue/8.

In the shorter term, I'm not sure why the xdg_wm_base is not available
in your version of Plasma. According to

https://phabricator.kde.org/D13510

and

http://blog.davidedmundson.co.uk/blog/my-month-in-kwinwayland/

"...KWin 5.14 will have support for XDG WM Base..."

the xdg_wm_base extension should be available in the version you run.

Is there a chance you might be running the Weston reference compositor?
Being a reference implementation, it lags behind on the desktop-oriented
features. For example, you need Weston 6.0 to get xdg_wm_base support.

If you can, please post a dump of running a Gio program with
WAYLAND_DEBUG=1 set. That dump should reveal whether it is really your
compositor lacking xdg_wm_base or a Gio bug.

-- elias

husam alkdary

unread,
Mar 12, 2020, 1:03:52 PM3/12/20
to golang-nuts
where I can find a simple examples of GIO with golang so I can try it

Elias Naur

unread,
Mar 12, 2020, 1:34:29 PM3/12/20
to husam alkdary, golang-nuts
On Thu, Mar 12, 2020 at 6:03 PM husam alkdary <husamal...@gmail.com> wrote:
>
> where I can find a simple examples of GIO with golang so I can try it
>

There are 4 examples here:

https://git.sr.ht/~eliasnaur/gio/tree/master/example

You can run them from a Go module with `go run`. For example:

$ go run gioui.org/example/kitchen

For a primer of the unusual stateless approach to GUI programming, see the
article

https://eliasnaur.com/blog/immediate-mode-gui-programming

-- elias

Jason E. Aten

unread,
Mar 16, 2020, 10:55:33 PM3/16/20
to golang-nuts
As an addition to Elias' examples, I wrote a little hello world++ here.

https://github.com/glycerine/hello_gio

nuskent...@gmail.com

unread,
Apr 18, 2020, 12:18:26 AM4/18/20
to golang-nuts
Thank you for your Contribution to ease the gioui.
Following link you mentioned for installation in your read file


does not working now.

Please explain me how to install goui.
Thank you again.

Elias Naur

unread,
Apr 18, 2020, 3:52:04 AM4/18/20
to nuskent...@gmail.com, golang-nuts
On Fri Apr 17, 2020 at 6:38 PM, wrote:
>
> Thank you for your Contribution to ease the gioui.
> Following link you mentioned for installation in your read file
>
> https://man.sr.ht/~eliasnaur/gio/install.md
>
> does not working now.
>
> Please explain me how to install goui.
> Thank you again.
>

Hi,

The website for Gio is gioui.org, which should contain enough
information for you to get started.

-- elias

Fino

unread,
Apr 28, 2020, 9:22:53 AM4/28/20
to golang-nuts
hello Elias,

as far as I understand, GIO is a 2D GUI lib, maybe similar with Flutter, 

is it possible to embed one/multi 3D widget inside a view/window? 

any architecture thinking on such requirement?

BR fino

Elias Naur

unread,
Apr 28, 2020, 9:42:13 AM4/28/20
to Fino, golang-nuts
The other way around is possible: embedding Gio into a program that uses
the GPU. See the "glfw" example:

https://git.sr.ht/~eliasnaur/gio/tree/master/example/glfw/main.go

-- elias

Fino

unread,
Apr 28, 2020, 9:45:40 PM4/28/20
to golang-nuts
OK, more complex than I thought.  need more learning ~ 

BR fino

osose...@gmail.com

unread,
Jul 24, 2020, 12:15:48 PM7/24/20
to golang-nuts
Hello, I do not want to drag us back but i really dont understand the way to install gio everywhere i look the mwthod is not straightforward and i dont ubderstand it can i know if there is a better way to install it
Thanks from Africa!
Reply all
Reply to author
Forward
0 new messages