diff options
Diffstat (limited to 'src/pomo')
| -rw-r--r-- | src/pomo/mod.rs | 14 |
1 files changed, 10 insertions, 4 deletions
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 |