feat(tui): per-session cpu/mem readout + caffeinate flag in sidebar#57
Open
mmoscosa wants to merge 7 commits into
Open
feat(tui): per-session cpu/mem readout + caffeinate flag in sidebar#57mmoscosa wants to merge 7 commits into
mmoscosa wants to merge 7 commits into
Conversation
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.
What
Adds per-session resource visibility to the sidebar, gated behind a single config flag
sidebar.show_session_stats(default on):Current cpu/mem inline on every row — a compact
<cpu>% <mem>readout (e.g.5% 1.0G) in the right-hand slot (taking the last-seen-age slot when a stat is available). now = the live sum of every process across every pane in that tmux session.Rolling peak under the focused row — the selected row expands with two lines:
cpu <now>% now · <peak>% peakandmem <now> now · <peak> peak. peak = the rolling max over the last 60 proc-poll samples (~2 min).Coffee glyph (Nerd-Font
nf-fa-coffee,U+F0F4) beside any session runningcaffeinate. Scope is correct by construction — only pane process-trees are walked, so an agent-spawnedcaffeinate(e.g. an editor/agent keep-awake) flags the session but a standalone one started outside tmux does not.How
internal/tui/session_stats.go:computeSessionTotals(reuses the existingaggStats+proc.BuildTree+tmux.GroupBySessionsprimitives) andSessionStatsModel(rolling-peak ring, pruned when a session disappears). The zero value is usable — no constructor wiring.handleProcDataMsgright next to the existingSetProcLabelscall; pushed into the sidebar viaSetSessionStats.nodeHeightbecomes cursor-aware (+2rows for the focused peak lines); the coffee glyph is a themed indicator (IconCaffeine).Tests
go test ./...green. Unit coverage for aggregation, caffeinate detection (positive + negative scope), rolling-peak decay/hold/prune, the config default, the coffee indicator, the inline per-row readout, the focused-row peak lines, and the cursor-awarenodeHeight.Notes
mainwith nogo.modchurn.nodeHeight+ the line→node hit map), so it'll be opened stacked once this lands.