Skip to content

feat: add tmux session preview panel #110

@renato0307

Description

@renato0307

Summary

Add a toggleable preview panel that displays the content of the selected tmux session's active pane.

Behavior

  • Toggle: Press v to show/hide the preview panel
  • Layout: When visible, splits the content area 50/50 with the session list
  • Content: Shows the active pane of the currently selected session
  • Auto-refresh: Uses fast polling (300-500ms) to keep content up-to-date
  • Selection change: When selecting a different session, preview updates to show that session's content

Settings

Setting Type Default Description
preview_layout string vertical Layout direction: vertical (list top, preview bottom) or horizontal (list left, preview right)
preview_max_lines int 50 Maximum lines to capture (actual lines shown depends on available terminal space)

Technical Approach

Capturing tmux content

# Get active window.pane for session
tmux display-message -p -t <session> '#{window_index}.#{pane_index}'

# Capture last N lines from active pane
tmux capture-pane -p -t <session>:<window>.<pane> -S -<lines>

Refresh strategy

Fast polling at 300-500ms interval while preview is visible. Simple, reliable, and effectively indistinguishable from true streaming for this use case.

UI Mockup

Vertical layout (default)

┌─────────────────────────────────┐
│  Session List                   │
│  ─────────────────────────────  │
│  > session-1  [Working]         │
│    session-2  [Idle]            │
│    session-3  [Waiting]         │
├─────────────────────────────────┤
│  Preview (session-1)            │
│  ─────────────────────────────  │
│  $ claude                       │
│  > Working on feature...        │
│  ...                            │
└─────────────────────────────────┘

Horizontal layout

┌────────────────┬────────────────┐
│  Session List  │  Preview       │
│  ────────────  │  ────────────  │
│  > session-1   │  $ claude      │
│    session-2   │  > Working...  │
│    session-3   │  ...           │
└────────────────┴────────────────┘

Tasks

  • Add preview_layout and preview_max_lines to settings
  • Add tmux client method to capture pane content
  • Create preview panel UI component
  • Implement toggle logic with v key
  • Add polling mechanism for auto-refresh
  • Update help screen with new shortcut
  • Calculate visible lines based on available terminal space

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions