Gtk4.jl

Experimental Julia package for Gtk4, using GObject introspection
Author JuliaGtk
Popularity
23 Stars
Updated Last
1 Year Ago
Started In
November 2021

Julia interface to GTK version 4

CI codecov.io

GUI building using the GTK library, version 4. For a mature Julia package that supports GTK version 3, see Gtk.jl. Note that Gtk.jl and Gtk4.jl cannot be imported in the same Julia session.

This package builds on Gtk.jl but uses GObject introspection to support more of the functionality of the GTK library and its dependencies. GObject introspection for Julia is implemented using GI.jl, which is also hosted in this repository.

Most of the code for GLib support (GType, GValue, GObject, etc.) was copied with minor changes from Gtk.jl. This includes integration of the GLib main loop with Julia's event loop.

Documentation for this package can be found here. Complete GTK documentation is available at https://www.gtk.org/docs.

Current status

Gtk4.jl is not recommended on 32 bit systems because of a deficiency with how GObject introspection is done here.

Enabling GTK4's EGL backend (Linux)

On Wayland, a Cairo-based fallback backend will be used unless you tell libglvnd_jll where to find libEGL. This can be done by setting the environment variable __EGL_VENDOR_LIBRARY_DIRS. See here for details.

For convenience, in Gtk4.jl this can be set as a preference for a particular Julia environment using Preferences.jl:

using Gtk4
Gtk4.set_EGL_vendorlib_dirs("/usr/share/glvnd/egl_vendor.d")
[ Info: Setting will take effect after restarting Julia.

where "/usr/share/glvnd/egl_vendor.d" is a typical location for Mesa's libEGL (this should be modified if it's somewhere else on your distribution). Other vendor-provided libraries may be in other locations, and a colon-separated list of directories can be used for that situation. Note that this has only been tested for the Mesa-provided libEGL on Fedora and Ubuntu.