change timeline style

This commit is contained in:
Julian Freeman
2026-03-22 16:04:22 -04:00
parent 7f9e0de193
commit 15d84dace4
2 changed files with 225 additions and 167 deletions

View File

@@ -95,8 +95,9 @@ pub fn start_engine(app: AppHandle) {
});
tauri::async_runtime::spawn(async move {
// Every 60 seconds
let mut ticker = interval(Duration::from_secs(60));
// Check every 500ms to be precise about the 0th second
let mut ticker = interval(Duration::from_millis(500));
let mut last_minute = -1;
loop {
ticker.tick().await;
@@ -105,9 +106,17 @@ pub fn start_engine(app: AppHandle) {
continue;
}
println!("Tick: capturing screen...");
if let Err(e) = capture_screens(&app).await {
eprintln!("Failed to capture screens: {}", e);
let now = Local::now();
let current_minute = now.format("%M").to_string().parse::<i32>().unwrap_or(0);
let current_second = now.format("%S").to_string().parse::<i32>().unwrap_or(0);
// Trigger only if it's the 0th second and we haven't captured this minute yet
if current_second == 0 && current_minute != last_minute {
last_minute = current_minute;
println!("Tick: capturing screen at {:02}:{:02}:00...", now.format("%H"), current_minute);
if let Err(e) = capture_screens(&app).await {
eprintln!("Failed to capture screens: {}", e);
}
}
}
});