This commit is contained in:
Julian Freeman
2026-03-01 00:55:02 -04:00
parent 18786607b1
commit cb9088e8b0
8 changed files with 77 additions and 13 deletions

54
Cargo.lock generated
View File

@@ -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"

View File

@@ -9,3 +9,4 @@ chrono = "0.4"
[build-dependencies]
slint-build = "1.15.1"
embed-resource = "1.8"

BIN
assets/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

1
assets/icon.rc Normal file
View File

@@ -0,0 +1 @@
id ICON "icon.ico"

View File

@@ -1,22 +1,25 @@
<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<!-- 背景圆盘 -->
<circle cx="256" cy="256" r="240" fill="#191919" stroke="#333333" stroke-width="4"/>
<!-- 外层发光环 -->
<circle cx="256" cy="256" r="240" fill="#042a1d" stroke="#05C46B" stroke-width="12"/>
<!-- 内部核心层:改用稍浅一点的墨绿色 (#07614e) 增加层次感 -->
<circle cx="256" cy="256" r="228" fill="#07614e" stroke="#0BE881" stroke-width="2" stroke-opacity="0.4"/>
<!-- 刻度 (12, 3, 6, 9) -->
<rect x="253" y="40" width="6" height="20" rx="3" fill="#444444" />
<rect x="253" y="452" width="6" height="20" rx="3" fill="#444444" />
<rect x="40" y="253" width="20" height="6" rx="3" fill="#444444" />
<rect x="452" y="253" width="20" height="6" rx="3" fill="#444444" />
<rect x="253" y="45" width="6" height="15" rx="3" fill="#0BE881" />
<rect x="253" y="452" width="6" height="15" rx="3" fill="#0BE881" />
<rect x="45" y="253" width="15" height="6" rx="3" fill="#0BE881" />
<rect x="452" y="253" width="15" height="6" rx="3" fill="#0BE881" />
<!-- 时针 (指向10点) -->
<line x1="256" y1="256" x2="160" y2="200" stroke="#FFFFFF" stroke-width="14" stroke-linecap="round" />
<!-- 分针 (指向2点) -->
<line x1="256" y1="256" x2="370" y2="190" stroke="#BBBBBB" stroke-width="10" stroke-linecap="round" />
<!-- 分针 (指向2点,稍长) -->
<line x1="256" y1="256" x2="385" y2="180" stroke="#BBBBBB" stroke-width="10" stroke-linecap="round" />
<!-- 秒针 (指向12点亮红色) -->
<line x1="256" y1="270" x2="256" y2="80" stroke="#FF3B30" stroke-width="4" stroke-linecap="round" />
<!-- 秒针 (指向约7点方向亮红色在绿底上非常醒目) -->
<line x1="260" y1="242" x2="210" y2="426" stroke="#FF3F34" stroke-width="4" stroke-linecap="round" />
<!-- 中心轴 -->
<circle cx="256" cy="256" r="10" fill="#191919" stroke="#FFFFFF" stroke-width="4"/>
<!-- 中心轴:背景色同步更新 -->
<circle cx="256" cy="256" r="10" fill="#07614e" stroke="#FFFFFF" stroke-width="4"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

6
build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -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;