From b885efbf21f2839318a46e484654e706821b716e Mon Sep 17 00:00:00 2001 From: Saiyed Shizain Date: Fri, 11 Sep 2026 23:47:11 +0530 Subject: fix: improve hot-reload responsiveness and prevent flashes --- src/pomo/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/pomo') diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs index 3a79d40..2ccecbb 100644 --- a/src/pomo/mod.rs +++ b/src/pomo/mod.rs @@ -82,10 +82,12 @@ impl Pomo { .and_then(|m| m.modified()) .ok(); - if current_mtime != self.theme_mtime { + if current_mtime.is_some() && current_mtime != self.theme_mtime { let (new_theme, new_mtime) = state::Theme::load_with_mtime(); - self.theme = new_theme; - self.theme_mtime = new_mtime; + if new_mtime.is_some() { + self.theme = new_theme; + self.theme_mtime = new_mtime; + } } } } @@ -136,6 +138,7 @@ impl Pomo { let mut terminal = Terminal::new(backend)?; let mut second_tick = tokio::time::interval(Duration::from_secs(1)); + let mut theme_tick = tokio::time::interval(Duration::from_millis(100)); let _ = self.export_status(); @@ -145,10 +148,13 @@ impl Pomo { tokio::select! { _ = second_tick.tick() => { self.tick(); - self.check_theme_reload(); let _ = self.export_status(); } + _ = theme_tick.tick() => { + self.check_theme_reload(); + } + // Tighten poll to 16ms (~60fps feel) for input responsiveness event_res = tokio::task::spawn_blocking(|| event::poll(Duration::from_millis(16))) => { if let Ok(Ok(true)) = event_res -- cgit v1.2.3