pub enum DisplayState {
Working,
Compacting,
NeedsInput,
Idle,
Stale,
}Expand description
Visual display state for a session in the TUI.
Represents the simplified user-facing state of a session, derived from
the underlying SessionStatus and activity timing. This provides clear
visual feedback about whether the user needs to take action.
§State Definitions
- Working: Claude is actively processing (recent activity within 5s)
- Compacting: Working after significant context reduction
- NeedsInput: User’s turn - either permission needed or awaiting next message
- Stale: No activity for extended period (>8 hours)
§Key Insight
If Claude isn’t actively generating or running a tool with recent activity, the session needs user input. Tool execution without updates likely means Claude is waiting for user confirmation (“Do you want to proceed?”).
Variants§
Working
Actively processing with recent activity
Compacting
Working after context reduction (compaction detected)
NeedsInput
Waiting for user input or permission (blocked, urgent)
Idle
Idle - no recent activity but not stale (relaxed, non-urgent)
Stale
No activity for extended period (>8 hours)
Implementations§
Source§impl DisplayState
impl DisplayState
Sourcepub fn icon(&self) -> &'static str
pub fn icon(&self) -> &'static str
Returns the ASCII icon for this state.
Uses ASCII characters for terminal compatibility:
>Working (active indicator)~Compacting (context shrinking)!NeedsInput (attention needed)-Idle (relaxed, waiting)zStale (sleeping)
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Returns a description of this state.
Sourcepub fn should_blink(&self) -> bool
pub fn should_blink(&self) -> bool
Returns true if this state should blink in the UI.
Only truly urgent/blocked states blink:
- NeedsInput: Blocked, waiting for permission (urgent)
States that do NOT blink:
- Idle: Relaxed “waiting for user” state
- Stale: Old session, low priority, doesn’t need attention
Sourcepub fn from_session(
time_since_activity_secs: i64,
status: &SessionStatus,
context_percentage: f64,
previous_context_percentage: Option<f64>,
) -> Self
pub fn from_session( time_since_activity_secs: i64, status: &SessionStatus, context_percentage: f64, previous_context_percentage: Option<f64>, ) -> Self
Determines display state from session data.
§Algorithm
- Stale check: >8 hours idle → Stale
- Permission check: waiting for permission → NeedsInput (urgent, blocked)
- Explicit Thinking/RunningTool status → Working (trust these regardless of activity)
- Generic Active status with recent activity (<5s) → Working/Compacting
- Generic Active status without recent activity → Idle (relaxed, non-urgent)
- Otherwise → Idle
§Arguments
time_since_activity_secs- Seconds since last activitystatus- Current session statuscontext_percentage- Current context usage percentageprevious_context_percentage- Previous context percentage for compaction detection
Trait Implementations§
Source§impl Clone for DisplayState
impl Clone for DisplayState
Source§fn clone(&self) -> DisplayState
fn clone(&self) -> DisplayState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more