Minimal bar
- Is not of the type "dock" yet
This commit is contained in:
parent
d7504bce1d
commit
d587a9866b
6
.gitignore
vendored
6
.gitignore
vendored
@ -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/
|
||||
|
||||
test/
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
||||
16
Cargo.toml
Normal file
16
Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "chocobar"
|
||||
description = "An experiment to create a topbar for X11 using Rust and Slint"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
authors = ["candifloss <candifloss.cc>"]
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
raw-window-handle = "0.6.2"
|
||||
slint = { version = "1.14.1", features = ["raw-window-handle-06", "renderer-software"] }
|
||||
winit = { version = "0.30.12", features = ["x11rb"] }
|
||||
x11rb = "0.13.2"
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.14.1"
|
||||
3
build.rs
Normal file
3
build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
slint_build::compile("ui/topbar.slint").unwrap();
|
||||
}
|
||||
18
src/main.rs
Normal file
18
src/main.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use slint::{LogicalPosition, LogicalSize};
|
||||
|
||||
slint::include_modules!();
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let bar_height = 25;
|
||||
let bar_width = 1366;
|
||||
|
||||
let ui = TopBar::new()?;
|
||||
ui.set_bar_width(bar_width);
|
||||
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()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
42
ui/topbar.slint
Normal file
42
ui/topbar.slint
Normal file
@ -0,0 +1,42 @@
|
||||
export component TopBar inherits Window {
|
||||
|
||||
in property<int> bar_width;
|
||||
in property<int> bar_height;
|
||||
|
||||
title: "chocobar";
|
||||
width: bar_width *1px;
|
||||
height: bar_height *1px;
|
||||
always-on-top: true;
|
||||
no-frame: true;
|
||||
//background: #999898a6;
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
|
||||
Rectangle {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #999898a6;
|
||||
border-radius: 0px;
|
||||
|
||||
HorizontalLayout {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
Rectangle {
|
||||
background: #79a9af7b;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
background: #779e5c7a;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
background: #c2779a7a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user