From 15d84dace4238aa3b0e59e55b322abae018b9818 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sun, 22 Mar 2026 16:04:22 -0400 Subject: [PATCH] change timeline style --- src-tauri/src/engine.rs | 19 +- src/App.vue | 373 +++++++++++++++++++++++----------------- 2 files changed, 225 insertions(+), 167 deletions(-) diff --git a/src-tauri/src/engine.rs b/src-tauri/src/engine.rs index c73f219..3245c8a 100644 --- a/src-tauri/src/engine.rs +++ b/src-tauri/src/engine.rs @@ -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::().unwrap_or(0); + let current_second = now.format("%S").to_string().parse::().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); + } } } }); diff --git a/src/App.vue b/src/App.vue index 95ed75e..a5186b3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,26 +1,41 @@