- Cargo.toml: depend on bread-theme (path dep for local dev, git dep for production) with gtk feature; remove local theme dependencies - src/theme.rs: replace local pywal/Catppuccin impl with bread_theme::gtk helpers; local bar-specific CSS is preserved - bakery.toml: describes breadbar for bakery install - release.yml: builds on hestia self-hosted runner, publishes binary to dl.breadway.dev and GitHub Releases on v* tags
21 lines
786 B
Rust
21 lines
786 B
Rust
use crate::{App, AppInput};
|
|
use relm4::ComponentSender;
|
|
|
|
pub fn current() -> String {
|
|
let dt = gtk4::glib::DateTime::now_local().expect("local time");
|
|
let date = dt.format("%a %d/%m").expect("date format");
|
|
let time = format!("{:02}:{:02}", dt.hour(), dt.minute());
|
|
format!("{} {}", date, time)
|
|
}
|
|
|
|
pub fn spawn_ticker(sender: ComponentSender<App>) {
|
|
relm4::spawn(async move {
|
|
loop {
|
|
sender.input(AppInput::ClockTick);
|
|
// Sleep until the top of the next minute — display is HH:MM only.
|
|
let secs = gtk4::glib::DateTime::now_local().map_or(0, |dt| dt.second());
|
|
let wait = (60 - secs.rem_euclid(60)) as u64;
|
|
tokio::time::sleep(std::time::Duration::from_secs(wait.max(1))).await;
|
|
}
|
|
});
|
|
}
|