I've been wanting to get my feet wet with GUI programming using Rust, and I finally found a simple enough tool to do so; it's found at Dioxus Labs.
I'm doing this on a Debian 12 GNU/Linux Box, with Cinnamon as my Desktop.
Install Rust, and make sure you can compile and run a simple "Hello, World" program.
# apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
$ cargo new --bin demo
(The --bin is optional; it's assumed if not given.)
Then edit the src/main.rs file to the following:
#![allow(non_snake_case)]
// import the prelude to get access to the `rsx!` macro and the `Element` type
use dioxus::prelude::*;
fn main() {
// launch the dioxus app in a webview
launch(App);
}
// define a component that renders a div with the text "Hello, world!"
fn App() -> Element {
rsx! { div { "Hello, world!" } }
}
// end of main()
And run the program to display a window with a "Hello, World!" message. Simple.
$ cargo run