Introduce properties and basic layout

This commit is contained in:
Candifloss 2025-11-13 17:31:37 +05:30
parent 28e2d2a50a
commit 5aa6396c87
3 changed files with 44 additions and 11 deletions

View File

@ -11,6 +11,7 @@ slint = "1.14.1"
smithay-client-toolkit = { version = "0.20.0", features = ["calloop"] } smithay-client-toolkit = { version = "0.20.0", features = ["calloop"] }
wayland-client = "0.31.11" wayland-client = "0.31.11"
winit = "0.30.12" winit = "0.30.12"
x11rb = "0.13.2"
[build-dependencies] [build-dependencies]
slint-build = "1.14.1" slint-build = "1.14.1"

View File

@ -1,10 +1,17 @@
use slint::{LogicalPosition, LogicalSize};
slint::include_modules!(); slint::include_modules!();
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let bar_height = 25;
let bar_width = 1366;
let ui = TopBar::new()?; let ui = TopBar::new()?;
ui.window().set_size(slint::LogicalSize::new(1000.0, 25.0)); ui.set_bar_width(bar_width);
ui.window().set_position(slint::LogicalPosition::new(0.0,0.0)); ui.set_bar_height(bar_height);
ui.window()
.set_size(LogicalSize::new(bar_width as f32, bar_height as f32));
ui.window().set_position(LogicalPosition::new(0.0, 0.0));
ui.run()?; ui.run()?;
Ok(()) Ok(())

View File

@ -1,17 +1,42 @@
export component TopBar inherits Window { export component TopBar inherits Window {
in property<int> bar_width;
in property<int> bar_height;
title: "chocobar"; title: "chocobar";
width: 1000px; width: bar_width *1px;
height: 25px; height: bar_height *1px;
always-on-top: true; always-on-top: true;
no-frame: true; no-frame: true;
background: #999898a6; //background: #999898a6;
x: 0px;
y: 0px;
topbar := Rectangle { Rectangle {
x: 0px;
y: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 4px; background: #999898a6;
background: #79a9af7b; border-radius: 0px;
drop-shadow-blur: 15px;
drop-shadow-color: #00000066; HorizontalLayout {
x: 0px;
y: 0px;
width: 100%;
height: 100%;
Rectangle {
background: #79a9af7b;
}
Rectangle {
background: #779e5c7a;
}
Rectangle {
background: #c2779a7a;
}
}
} }
} }