This repository has all of the necessary boilerplate to build a GTK4 application against the elementary Flatpak Platform using the Granite 7 library.
The example code uses the Granite.Placeholder
widget to show a welcome screen, supports the user's dark style preference, remembers the window size and state, uses a custom icon from a GResource file, sets up translations, and has some sample unit tests for the welcome view widget.
You are free to extend upon this template in any way you see fit.
- meson
- libgranite-7-dev
- libgtk-4-dev
- rust >= 1.64 (Install from rustup as the version available on elementary OS 7.0 is not new enough)
git clone https://github.com/davidmhewitt/elementary-rust-example
cd elementary-rust-example
meson setup build
cd build
ninja
ninja install
src/elementary-rust-example
To regenerate translation files (run inside the build directory):
ninja io.github.davidmhewitt.ElementaryRustExample-pot
ninja io.github.davidmhewitt.ElementaryRustExample-update-po
ninja extra-pot
ninja extra-update-po
This repository is set up with a number of actions to help the development process.
- Dependabot is configured to update Rust dependencies in your Cargo files.
- There is an action to test building a Flatpak package against the elementary runtime.
- There is an action to test building the application outside of a Flatpak in an elementary Docker container.
- Finally, there is action to update
cargo-sources.json
when your Cargo manifests change. This file lists the Cargo crates thatflatpak-builder
has to download before attempting an offline build in a container.
Please open an issue if you find any problems or want to get support.
- GUI development with Rust and GTK 4
- Granite Documentation (for Vala, but still useful and relevant)
- granite-rs examples (Granite demo partially re-implemented in Rust)