#elm #gtk #gtk4

relm4-icons-build

Icons for gtk-rs and Relm4 applications

2 releases

0.10.0-beta.2 Dec 4, 2024
0.10.0-beta.1 Oct 30, 2024

#912 in GUI

Download history 73/week @ 2024-10-24 79/week @ 2024-10-31 93/week @ 2024-11-07 54/week @ 2024-11-14 37/week @ 2024-11-21 115/week @ 2024-11-28 227/week @ 2024-12-05 66/week @ 2024-12-12

453 downloads per month

(Apache-2.0 OR MIT) AND CC0-1.0 AND MIT

1MB
144 lines

relm4-icons-build

This crate provides the build-time functionality to bundle icons into the binary. It is used in the build.rs file of the project that uses relm4-icons.

Usage

Add this to your Cargo.toml:

[build-dependencies]
relm4-icons-build = { version = "0.8.0" }

And in your build.rs file, use relm4-icons-build to bundle the icons and include them in the compiled binary:

fn main() {
    relm4_icons_build::bundle_icons(
        // Name of the file that will be generated at `OUT_DIR`
        "icon_names.rs",
        // Optional app ID
        Some("com.example.myapp"),
        // Custom base resource path:
        // * defaults to `/com/example/myapp` in this case if not specified explicitly
        // * or `/org/relm4` if app ID was not specified either
        None::<&str>,
        // Directory with custom icons (if any)
        None::<&str>,
        // List of icons to include
        [
            "ssd",
            "size-horizontally",
            "cross",
        ],
    );
}

And in your main.rs or lib.rs file, create a module named icon_names:

mod icon_names {
    include!(concat!(env!("OUT_DIR"), "/icon_names.rs"));
}

Dependencies

~5–12MB
~143K SLoC