- Write `run_cmd()` to run commands - Separate command execution from Slint callbacks - Rename `TimeWidget`'s callback `open_program()` as `show_clock()`
62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
import { TimeWidget } from "time-widget.slint";
|
|
|
|
export component TopBar inherits Window {
|
|
|
|
in property<int> bar_width;
|
|
in property<int> bar_height;
|
|
|
|
callback show_clock();
|
|
|
|
title: "chocobar";
|
|
width: bar_width *1px;
|
|
height: bar_height *1px;
|
|
always-on-top: true;
|
|
no-frame: true;
|
|
x: 0px;
|
|
y: 0px;
|
|
default-font-family: "IosevkaTermSlab Nerd Font Mono";
|
|
default-font-size: 14px;
|
|
|
|
Rectangle {
|
|
x: 0px;
|
|
y: 0px;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #999898a6;
|
|
border-radius: 0px;
|
|
|
|
HorizontalLayout {
|
|
x: 0px;
|
|
y: 0px;
|
|
width: 100%;
|
|
height: 100%;
|
|
alignment: space-between;
|
|
|
|
// Left side
|
|
Rectangle {
|
|
background: #79a9af7b;
|
|
width: parent.width/3;
|
|
}
|
|
|
|
// Middle
|
|
Rectangle {
|
|
background: #779e5c7a;
|
|
}
|
|
|
|
// Right side
|
|
Rectangle {
|
|
background: #c2779a7a;
|
|
width: parent.width/3;
|
|
|
|
HorizontalLayout {
|
|
alignment: end; // RIght-align
|
|
|
|
TimeWidget {
|
|
time_text: "11:43 AM"; // Fix this: Replace with time value
|
|
show_clock => root.show_clock(); // Forward the widget's callback to the root's to access from Rust
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |