diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-06-13 00:05:35 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-06-13 00:05:35 +0530 |
| commit | 1dd93bbb49e305a3f3081ded013b46f6be43ba94 (patch) | |
| tree | 4312c8a6c0eece6917c681e5ba1cadbc246ee8a1 /src/pomo | |
| parent | e2cd4834f116b35e0a61666368d8fc93382fc38e (diff) | |
| download | pomoru-1dd93bbb49e305a3f3081ded013b46f6be43ba94.tar.xz pomoru-1dd93bbb49e305a3f3081ded013b46f6be43ba94.zip | |
add export status method and call it on every tick
Diffstat (limited to 'src/pomo')
| -rw-r--r-- | src/pomo/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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<dyn std::error::Error>> { 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 |