7 releases (4 breaking)

Uses new Rust 2021

0.4.2 Jan 17, 2022
0.4.1 Jan 15, 2022
0.3.1 Oct 8, 2021
0.3.0 Sep 21, 2021
0.0.0 Apr 4, 2021

#10 in #gsk4

Download history 477/week @ 2021-10-08 600/week @ 2021-10-15 533/week @ 2021-10-22 549/week @ 2021-10-29 436/week @ 2021-11-05 375/week @ 2021-11-12 636/week @ 2021-11-19 477/week @ 2021-11-26 456/week @ 2021-12-03 465/week @ 2021-12-10 344/week @ 2021-12-17 326/week @ 2021-12-24 367/week @ 2021-12-31 450/week @ 2022-01-07 787/week @ 2022-01-14 652/week @ 2022-01-21

2,290 downloads per month
Used in gdk4-wayland

MIT license

203 lines

gtk4-rs CI

A group of crates that aims to provide complete GTK 4 bindings. This repository contains all the "core" crates of GTK 4.

  • GTK
  • GDK: An intermediate layer which isolates GTK from the details of the windowing system.
  • GSK: An intermediate layer which isolates GTK from the details of the OpenGL or Vulkan implementation.

The GTK 4 crates also depends on other libraries part of the platform like:

Those are common with the GTK 3 and GStreamer bindings and are part of the gtk-rs-core repository.

For more information about each crate, please refer to their README.md file in their directory.

Minimum supported Rust version

Currently, the minimum supported Rust version is 1.56.0.


Useful links


The gtk4-rs repository contains Rust crates for GTK 4. However there is a large ecosystem of GObject libraries and many of these libraries have Rust bindings based on the tooling included in gtk-rs. Of particular note:

  • gtk-rs-core - bindings for some of the core libraries such as glib, gio, pango, graphene
  • gstreamer-rs - bindings for the GStreamer media framework

Additionally, Rust bindings for various libraries are hosted on GNOME's GitLab instance and can be found at https://gitlab.gnome.org/World/Rust.

When using crates that are not part of the gtk4-rs repository, you will need to be careful and ensure that they do not pull in incompatible versions of core crates like glib-rs.

Built with GTK4 Rust bindings

Below is a list of applications built using the Rust bindings of GTK 4


The bindings are composed of two parts:

  • Automatically generated ones using gir
  • Manual parts

The automatic ones can be generated using the generator.py script

python3 ./generator.py

All the crates except gtk4-macros follow this structure

   ├── Gir.toml
   ├── README.md
   ├── src
   │   ╰── auto
   ├── sys
   ╰── tests
  • README.md: Explanations about the crate itself and eventually some details.
  • Gir.toml: Used by gir to generate most of the code.
  • src: Contains the source code of the crate.
  • src/auto: Contains the automatically generated part of the source code.
  • sys: Contains the 1:1 bindings of the C API.