diff --git a/.gitignore b/.gitignore index ab951f8..ab7e56e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,9 @@ Cargo.lock # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + + +# Added by cargo + +/target +test/ diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f8808f2 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +resolver = "3" +members = [ + "alarm_widg_config", "alarm_widg", +] + +[profile.release] +lto = "thin" +codegen-units = 1 +strip = "symbols" +opt-level = "z" +panic = "abort" \ No newline at end of file diff --git a/alarm_widg/Cargo.toml b/alarm_widg/Cargo.toml new file mode 100644 index 0000000..6036452 --- /dev/null +++ b/alarm_widg/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "alarm_widg" +version = "0.1.0" +edition = "2024" + +[dependencies] +alarm_widg_config = {path = "../alarm_widg_config"} +dirs = "6.0.0" +i-slint-backend-winit = "1.15.1" +slint = "1.15.1" +toml = "1.0.3" + +[build-dependencies] +slint-build = "1.15.1" diff --git a/alarm_widg/src/main.rs b/alarm_widg/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/alarm_widg/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/alarm_widg/ui/widget-popup.slint b/alarm_widg/ui/widget-popup.slint new file mode 100644 index 0000000..495df2d --- /dev/null +++ b/alarm_widg/ui/widget-popup.slint @@ -0,0 +1,94 @@ +export component MainWindow inherits Window { + + in property alarm_name: "Sample Alarm"; + in property alarm_time: "11:45AM"; + in property alarm_color: #232323; + in property popup_width: 300; + in property popup_height: 124; + in property default_font: "IosevkaTermSlab Nerd Font Mono"; + in property alarm_icon: "🕓"; + + always-on-top: true; + no-frame: true; + width: popup_width *1px; + height: popup_height *1px; + background: transparent; + default-font-family: default_font; + + Rectangle { + width: 100%; + height: 100%; + border-radius: 12px; + background: alarm_color; + drop-shadow-blur: 15px; + drop-shadow-color: #00000066; + + GridLayout { + padding: 12px; + width: 100%; + + // Icon + Rectangle { + row: 0; + col: 0; + colspan: 1; + rowspan: 3; + height: 100px; + width: 86px; + //background: #a13939; + Text { + height: 100%; + width: 100%; + vertical-alignment: center; + horizontal-alignment: center; + font-size: 85px; + text: root.alarm_icon; + color: white; + } + } + + // Name + Rectangle { + row: 0; + col: 1; + colspan: 4; + rowspan: 1; + height: 40px; + //width: 211px; + width: 186px; + //min-width: 0px; + //background: #2d888f; + Text { + height: 100%; + width: 100%; + vertical-alignment: center; + horizontal-alignment: TextHorizontalAlignment.left; + font-size: 18px; + text: root.alarm_name; + color: white; + } + } + + // Time + Rectangle { + row: 1; + col: 1; + colspan: 3; + rowspan: 2; + height: 60px; + width: 186px; + //background: #575757; + + Text { + height: 100%; + width: 100%; + vertical-alignment: center; + horizontal-alignment: TextHorizontalAlignment.left; + font-size: 50px; + text: root.alarm_time; + color: white; + } + } + } + } +} \ No newline at end of file diff --git a/alarm_widg_config/Cargo.toml b/alarm_widg_config/Cargo.toml new file mode 100644 index 0000000..df04132 --- /dev/null +++ b/alarm_widg_config/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "alarm_widg_config" +version = "0.1.0" +edition = "2024" + +[dependencies] +dirs = "6.0.0" +serde = { version = "1.0.228", features = ["derive"] } +toml = "1.0.3" diff --git a/alarm_widg_config/src/lib.rs b/alarm_widg_config/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/alarm_widg_config/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +}