Rust bindings of GTK 4
  • Rust 97.4%
  • C 2.6%
Find a file
2025-10-17 11:39:26 +01:00
.github build(deps): bump docker/login-action from 3.5.0 to 3.6.0 2025-10-06 10:53:23 +02:00
book Replace user_config_dir by user_data_dir (#2105) 2025-07-28 14:34:34 +02:00
examples Revert "build(deps): bump femtovg from 0.14.1 to 0.18.1" 2025-10-12 09:56:16 +03:00
gdk4 Regenerate with latest gir-files 2025-09-30 11:30:51 +02:00
gdk4-macos Regenerate with latest gir-files 2025-09-30 11:30:51 +02:00
gdk4-wayland fix(gdk4-wayland): egl feature does not compile without wayland-crate feature 2025-10-01 09:25:41 +02:00
gdk4-win32 Regenerate with latest gir-files 2025-09-30 11:30:51 +02:00
gdk4-x11 Regenerate with latest gir-files 2025-09-30 11:30:51 +02:00
gir@be9aa14526 Update gir 2025-09-30 11:30:51 +02:00
gir-files@e121d92cee Update gir-files 2025-09-30 11:30:51 +02:00
gsk4 Regenerate with latest gir-files 2025-09-30 11:30:51 +02:00
gtk4 fix(gtk4): remove deprecated warnings on style_context methods 2025-10-17 11:39:26 +01:00
gtk4-macros gtk4-macros: Fix link to Blueprint homepage 2025-08-19 14:00:42 +02:00
.gitignore misc: Add IntelliJ dir to .gitignore 2024-09-20 10:55:19 +02:00
.gitmodules Don't checkout submodules by default 2022-09-04 20:55:51 +02:00
.typos.toml typos: Ignore versions.txt file 2024-06-02 16:32:39 +03:00
Cargo.lock Revert "build(deps): bump femtovg from 0.14.1 to 0.18.1" 2025-10-12 09:56:16 +03:00
Cargo.toml Update gtk-rs-core version as well 2025-07-15 21:11:39 +02:00
CHANGELOG.md gtk4-macros: Stop appending using Gtk for blueprint 2024-12-18 09:56:56 +01:00
COPYRIGHT Rename project to "gtk-rs" 2021-06-07 20:21:17 +02:00
deny.toml deny: Update 2025-09-17 12:54:49 +02:00
Dockerfile image: Enable broadway backend 2025-05-16 13:47:30 +02:00
generator.py symlink generator.py from gir 2021-04-22 15:32:48 +02:00
LICENSE Improve COPYRIGHT / LICENSE files 2020-12-15 21:20:11 +01:00
README.md Bump MRSV to 1.83 2025-05-16 23:33:51 +02:00
rustfmt.toml Add rustfmt.toml to allow some editors to auto-format the code on save 2022-04-06 12:13:39 +03:00

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 Macos: Macos backend specific functions.
    • 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.83.

Documentation

Ecosystem

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

Contributing

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

   ./crate
   ├── 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.