chocobar-x11/ui/time-widget.slint
Candifloss 1d222795a3 Refactor for simplicity & modularity
- Write `run_cmd()` to run commands
- Separate command execution from Slint callbacks
- Rename `TimeWidget`'s callback `open_program()` as `show_clock()`
2025-11-19 21:51:13 +05:30

29 lines
748 B
Plaintext

export component TimeWidget {
in-out property <string> time_text;
callback show_clock(); // Callback to execute things from Rust, because Slint can't
Rectangle {
background: touch_area.pressed ? #555 : touch_area.has-hover ? #444 : #333; // Bg color based on click & hover
border-radius: 3px;
HorizontalLayout {
padding-right: 3px;
padding-left: 3px;
Text {
text: time_text;
color: white;
vertical-alignment: center;
}
}
// Area to sense click and hover
touch_area:= TouchArea {
clicked => {
show_clock();
}
}
}
}