From 28e2d2a50aa6a88e98759fbc91270a04a3db5b14 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 13 Nov 2025 00:14:31 +0530 Subject: [PATCH] Initial commit - Start building slint UI --- .gitignore | 7 +++++++ Cargo.toml | 16 ++++++++++++++++ README.md | 4 ++-- build.rs | 3 +++ src/main.rs | 11 +++++++++++ ui/topbar.slint | 17 +++++++++++++++++ 6 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 Cargo.toml create mode 100644 build.rs create mode 100644 src/main.rs create mode 100644 ui/topbar.slint diff --git a/.gitignore b/.gitignore index ab951f8..b548918 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,10 @@ 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 me +test/ + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..3efe542 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "chocobar" +description = "An experiment to create a topbar using Rust and Slint" +version = "0.0.1" +edition = "2024" +authors = ["candifloss "] +readme = "README.md" + +[dependencies] +slint = "1.14.1" +smithay-client-toolkit = { version = "0.20.0", features = ["calloop"] } +wayland-client = "0.31.11" +winit = "0.30.12" + +[build-dependencies] +slint-build = "1.14.1" diff --git a/README.md b/README.md index 5d2c3a2..2a34aba 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# chocobar +# Chocobar -A topbar/panel \ No newline at end of file +An experiment to create a topbar/panel using Rust and Slint. \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..99576fc --- /dev/null +++ b/build.rs @@ -0,0 +1,3 @@ +fn main() { + slint_build::compile("ui/topbar.slint").unwrap(); +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..a01b13f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,11 @@ +slint::include_modules!(); + +fn main() -> Result<(), Box> { + + let ui = TopBar::new()?; + ui.window().set_size(slint::LogicalSize::new(1000.0, 25.0)); + ui.window().set_position(slint::LogicalPosition::new(0.0,0.0)); + ui.run()?; + + Ok(()) +} diff --git a/ui/topbar.slint b/ui/topbar.slint new file mode 100644 index 0000000..1c555fa --- /dev/null +++ b/ui/topbar.slint @@ -0,0 +1,17 @@ +export component TopBar inherits Window { + title: "chocobar"; + width: 1000px; + height: 25px; + always-on-top: true; + no-frame: true; + background: #999898a6; + + topbar := Rectangle { + width: 100%; + height: 100%; + border-radius: 4px; + background: #79a9af7b; + drop-shadow-blur: 15px; + drop-shadow-color: #00000066; + } +} \ No newline at end of file