aboutsummaryrefslogtreecommitdiff
path: root/src/pomo
diff options
context:
space:
mode:
authorSaiyed Shizain <saiyedshizain@gmail.com>2026-09-11 23:47:11 +0530
committerSaiyed Shizain <saiyedshizain@gmail.com>2026-09-11 23:47:11 +0530
commitb885efbf21f2839318a46e484654e706821b716e (patch)
tree41c5a0e5e6bcf13b1aa895ab3260a471824d4901 /src/pomo
parentf0643844857175c3fccec5afb476bab7489d2b2c (diff)
downloadpomoru-b885efbf21f2839318a46e484654e706821b716e.tar.xz
pomoru-b885efbf21f2839318a46e484654e706821b716e.zip
fix: improve hot-reload responsiveness and prevent flashesfeat/hot-reload-theme
Diffstat (limited to 'src/pomo')
-rw-r--r--src/pomo/mod.rs14
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