Initial commit

- Start building slint UI
This commit is contained in:
Candifloss 2025-11-13 00:14:31 +05:30
parent d4087c22b2
commit 28e2d2a50a
6 changed files with 56 additions and 2 deletions

7
.gitignore vendored
View File

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

16
Cargo.toml Normal file
View File

@ -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 <candifloss.cc>"]
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"

View File

@ -1,3 +1,3 @@
# chocobar
# Chocobar
A topbar/panel
An experiment to create a topbar/panel using Rust and Slint.

3
build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
slint_build::compile("ui/topbar.slint").unwrap();
}

11
src/main.rs Normal file
View File

@ -0,0 +1,11 @@
slint::include_modules!();
fn main() -> Result<(), Box<dyn std::error::Error>> {
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(())
}

17
ui/topbar.slint Normal file
View File

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