24 releases

new 0.9.0 Jul 10, 2024
0.8.1 Mar 7, 2024
0.7.3 Sep 23, 2023
0.7.0 Jul 23, 2023
0.2.0 Jul 12, 2021

#661 in GUI

Download history 12936/week @ 2024-03-25 11642/week @ 2024-04-01 10123/week @ 2024-04-08 12654/week @ 2024-04-15 13877/week @ 2024-04-22 13841/week @ 2024-04-29 11671/week @ 2024-05-06 10676/week @ 2024-05-13 10090/week @ 2024-05-20 10987/week @ 2024-05-27 12076/week @ 2024-06-03 12388/week @ 2024-06-10 13560/week @ 2024-06-17 11778/week @ 2024-06-24 9845/week @ 2024-07-01 11385/week @ 2024-07-08

48,513 downloads per month
Used in 124 crates (16 directly)

MIT license

25K SLoC

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.
    • GDK Wayland: Wayland backend specific functions.
    • GDK Win32: Windows backend specific functions.
    • GDK X11: X backend specific functions.
  • 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.70.



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

A small list of applications built with gtk4-rs:

Libraries built with gtk4-rs:

  • Relm4: An idiomatic GUI library inspired by Elm


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

If you didn't do so yet, please check out all the submodules before via

$ git submodule update --checkout

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.


~79K SLoC