aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Nelson <jknlsn@users.noreply.github.com>2026-06-02 05:08:22 +1000
committerGitHub <noreply@github.com>2026-06-01 21:08:22 +0200
commit053898e1e245c0df9aaaa783710e88e2926fbbb2 (patch)
treec94807bae616eb7a430d35de504adf4e8873a101
parentchore: bump version to v0.23.0 (diff)
downloadsl0pstatus-053898e1e245c0df9aaaa783710e88e2926fbbb2.tar.gz
sl0pstatus-053898e1e245c0df9aaaa783710e88e2926fbbb2.tar.xz
sl0pstatus-053898e1e245c0df9aaaa783710e88e2926fbbb2.zip
fix: use timer events for idle refresh (#253)
-rw-r--r--src/bin/zjstatus.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bin/zjstatus.rs b/src/bin/zjstatus.rs
index 3f58683..9a9ae7b 100644
--- a/src/bin/zjstatus.rs
+++ b/src/bin/zjstatus.rs
@@ -20,6 +20,9 @@ use zjstatus::{
},
};
+// Matches the old incidental Zellij session scan cadence.
+const REFRESH_INTERVAL_SECONDS: f64 = 1.0;
+
#[derive(Default)]
struct State {
pending_events: Vec<Event>,
@@ -70,10 +73,12 @@ impl ZellijPlugin for State {
EventType::ModeUpdate,
EventType::PaneUpdate,
EventType::PermissionRequestResult,
+ EventType::Timer,
EventType::TabUpdate,
EventType::SessionUpdate,
EventType::RunCommandResult,
]);
+ set_timeout(REFRESH_INTERVAL_SECONDS);
self.module_config = match ModuleConfig::new(&configuration) {
Ok(mc) => mc,
@@ -294,6 +299,13 @@ impl State {
should_render = true;
}
+ Event::Timer(_) => {
+ tracing::Span::current().record("event_type", "Event::Timer");
+ set_timeout(REFRESH_INTERVAL_SECONDS);
+ self.state.cache_mask = 0;
+
+ should_render = true;
+ }
_ => (),
};
should_render