feat(dashboard): use inotify for event-driven redraws on Linux#14
Open
MuLinForest wants to merge 4 commits into
Open
feat(dashboard): use inotify for event-driven redraws on Linux#14MuLinForest wants to merge 4 commits into
MuLinForest wants to merge 4 commits into
Conversation
Replace fixed-interval polling with inotifywait when available. Dashboard now redraws only when session files change, reducing CPU usage to near-zero during idle periods. Falls back to the original 2s polling loop on macOS or when inotify-tools is not installed. If inotifywait exits unexpectedly, also falls back to polling rather than silently terminating. Header shows "(event-driven)" vs "(every 2s)" to reflect active mode. Closes kayhaowu#9 Co-Authored-By: Claude Code <claude-core@mulin.date>
read < file with 2>/dev/null does not suppress redirect errors in dash. Check file existence first to avoid spurious error output. Co-Authored-By: Claude Code <claude-core@mulin.date>
ac87d80 to
f824f97
Compare
…s redraws heartbeat.sh writes $PID.hb.dat every 2s, causing inotifywait to fire continuously and negating the event-driven benefit. Filter to only watch .status and .json files so redraws only happen on actual state changes. Co-authored-by: Claude Sonnet 4.6 <claude-code@mulin.date>
inotifywait prints the event (e.g. "MODIFY 990079.json") to stdout on each trigger, which leaked into the terminal between renders. Redirect stdout to /dev/null since only the exit code is needed. Co-Authored-By: Claude Sonnet 4.6 <claude-code@mulin.date>
MuLinForest
added a commit
to MuLinForest/claude-code-toolkit
that referenced
this pull request
Mar 26, 2026
…session_title in single jq call Resolve dashboard.sh conflict: add session_title to PR kayhaowu#17's consolidated jq read, removing the redundant individual jq calls from PR kayhaowu#15. Co-Authored-By: Claude Sonnet 4.6 <claude-code@mulin.date>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9
Summary
inotifywaitwhen available — redraws only on session file changes, near-zero CPU when idleinotify-toolsnot installed (macOS) or ifinotifywaitexits unexpectedly(event-driven)vs(every 2s)to reflect active mode_REFRESH_MODEglobal variable;render()needs no argumentsTest plan
inotify-tools: dashboard shows(event-driven), redraws on session changeinotify-tools: falls back to polling, shows(every 2s)inotifywaitmanually: dashboard continues via polling fallback