diff --git a/Cargo.lock b/Cargo.lock index 00bd752..a161df7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1182,6 +1182,19 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "embed-resource" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e62abb876c07e4754fae5c14cafa77937841f01740637e17d78dc04352f32a5e" +dependencies = [ + "cc", + "rustc_version", + "toml 0.5.11", + "vswhom", + "winreg", +] + [[package]] name = "endi" version = "1.1.1" @@ -2742,6 +2755,7 @@ name = "my-clock" version = "0.1.0" dependencies = [ "chrono", + "embed-resource", "slint", "slint-build", ] @@ -4094,7 +4108,7 @@ dependencies = [ "regex", "serde_json", "tar", - "toml", + "toml 0.9.12+spec-1.1.0", ] [[package]] @@ -4575,6 +4589,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "0.9.12+spec-1.1.0" @@ -4870,6 +4893,26 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "vtable" version = "0.3.0" @@ -5827,6 +5870,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index 4335d2f..2582feb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,4 @@ chrono = "0.4" [build-dependencies] slint-build = "1.15.1" +embed-resource = "1.8" diff --git a/assets/icon.ico b/assets/icon.ico new file mode 100644 index 0000000..bf49fc0 Binary files /dev/null and b/assets/icon.ico differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..07e97ab Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/icon.rc b/assets/icon.rc new file mode 100644 index 0000000..da47ee1 --- /dev/null +++ b/assets/icon.rc @@ -0,0 +1 @@ +id ICON "icon.ico" diff --git a/assets/icon.svg b/assets/icon.svg index 7fadba4..1375059 100644 --- a/assets/icon.svg +++ b/assets/icon.svg @@ -1,22 +1,25 @@ - - + + + + + - - - - + + + + - - + + - - + + - - + + diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..d56c34e --- /dev/null +++ b/build.rs @@ -0,0 +1,6 @@ +fn main() { + slint_build::compile("src/main.rs").unwrap(); + if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" { + embed_resource::compile("assets/icon.rc"); + } +} diff --git a/src/main.rs b/src/main.rs index 4f190e7..fa28242 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use chrono::{Local, Timelike}; slint::slint! { export component AppWindow inherits Window { title: "Modern Clock"; + icon: @image-url("../assets/icon.png"); no-frame: true; background: transparent; always-on-top: root.is_on_top;