From 1dd93bbb49e305a3f3081ded013b46f6be43ba94 Mon Sep 17 00:00:00 2001 From: RanXom Date: Sat, 13 Jun 2026 00:05:35 +0530 Subject: add export status method and call it on every tick --- src/pomo/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/pomo/mod.rs') diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs index 242c1df..c6bd35c 100644 --- a/src/pomo/mod.rs +++ b/src/pomo/mod.rs @@ -35,6 +35,16 @@ impl Pomo { } } + pub fn export_status(&self) -> std::io::Result<()> { + let status = self.current_status(); + + let json = serde_json::to_string(&status)?; + + // TODO: write to ~/.cache/pomoru/status.json + + Ok(()) + } + pub fn save(&self) -> Result<(), Box> { let config = Config { work_time_mins: self.work_time.as_secs() / 60, @@ -88,6 +98,7 @@ impl Pomo { tokio::select! { _ = second_tick.tick() => { self.tick(); + let _ = self.export_status(); } // Tighten poll to 16ms (~60fps feel) for input responsiveness -- cgit v1.2.3