Relm4

Matrix Relm4 on crates.io Relm4 docs

Relm4 is an idiomatic GUI library inspired by Elm and based on gtk4-rs. It is a new version of relm that's built from scratch and is compatible with GTK4 and libadwaita.

Visit the book of the stable version!

Why Relm4

We believe that GUI development should be easy, productive and delightful.
The gtk4-rs crate already provides everything you need to write modern, beautiful and cross-platform applications. Built on top of this foundation, Relm4 makes developing more idiomatic, simpler and faster and enables you to become productive in just a few hours.

Requirements

To work with Relm4, you should understand most basic language features of the Rust programming language. We recommend to at least be familiar with the content of the chapters 1, 3-6, 8, 10 and 13 of the Rust book.

I also recommend reading the gtk4-rs book for getting more insight into development with gtk4-rs. Yet, knowledge of GTK4 or gtk4-rs is not required in this book.

Helpful links:

Cargo:

Add the packages you need to your Cargo.toml:

gtk4 = "0.4.7"
relm4 = "0.5.0"
relm4-macros = "0.5.0"
relm4-components = "0.5.0"

Issues and feedback

If you find a mistake or something unclear in Relm4 or this book, let us know! Simply open up an issue or start a discussion over at GitHub or chat with us on Matrix.

Platform support

All platforms supported by GTK4 are available for Relm4 as well:

  • Linux
  • Windows
  • macOS

Examples

If you prefer learning directly from examples, we got you covered!

Many code examples in this book and many other examples can also be found in the git-repository. Whenever an example is discussed in the book, the introduction will mention the name of the example and provide a link to it.

To setup the examples run

git clone https://github.com/Relm4/Relm4.git
cd Relm4/examples

And to run an example, simply type

cargo run --example NAME

To get a list of all examples, run

cargo run --example

Screenshots

As a sneak peak here are screenshots of some examples.

Light ThemeDark Theme
Pop Over lightPop Over dark
Factory-Advanced lightFactory-Advanced dark

Special thanks

I want to thank all contributors of relm especially antoyo for building relm that inspired much of the work on Relm4.

Also, I want to thank all contributors of gtk-rs that put a lot of effort into the project for creating outstanding Rust bindings for GTK4.

I want to thank tronta for contributing a lot of improvements to this book.