Home

Awesome

GTK + Rust + Relm4 + Meson + Flatpak = <3

This is a fork of gtk-rust-template that adapts the code for Relm4 while trying to change as little as possible.

A boilerplate template to get started with GTK, Rust, Meson, Flatpak made for GNOME. It can be adapted for other desktop environments like elementary.

<div align="center">

Main window

</div>

What does it contains?

How to init a project ?

The template ships a simple python script to init a project easily. It asks you a few questions and replaces & renames all the necessary files.

The script requires having git installed on your system.

If you clone this repository, you can run it with:

python3 create-project.py

If you don't want to clone the repository, you can run it with:

python3 -c "$(wget -q -O - https://raw.githubusercontent.com/Relm4/relm4-template/main/create-project.py)" --online
➜ python3 create-project.py
Welcome to GTK Rust Template
Name: Contrast
Project Name: contrast
Application ID (e.g. org.domain.MyAwesomeApp, see: https://developer.gnome.org/ChooseApplicationID/): org.gnome.design.Contrast
Author: Bilal Elmoussaoui
Email: bil.elmoussaoui@gmail.com

A new directory named contrast containing the generated project

Building the project

Make sure you have flatpak and flatpak-builder installed. Then run the commands below. Replace <application_id> with the value you entered during project creation. Please note that these commands are just for demonstration purposes. Normally this would be handled by your IDE, such as GNOME Builder or VS Code with the Flatpak extension.

flatpak install --user org.gnome.Sdk//46 org.gnome.Platform//46  org.freedesktop.Sdk.Extension.rust-stable//23.08 org.freedesktop.Sdk.Extension.llvm16//23.08
flatpak-builder --user flatpak_app build-aux/<application_id>.Devel.json

Running the project

Once the project is build, run the command below. Replace Replace <application_id> and <project_name> with the values you entered during project creation. Please note that these commands are just for demonstration purposes. Normally this would be handled by your IDE, such as GNOME Builder or VS Code with the Flatpak extension.

flatpak-builder --run flatpak_app build-aux/<application_id>.Devel.json <project_name>

Community

Join the GNOME and gtk-rs community!

Credits