Skip to content

Add terminal graphics protocol support and fullscreen preview#3

Merged
ignaciotcrespo merged 1 commit into
mainfrom
terminal-graphics
Apr 18, 2026
Merged

Add terminal graphics protocol support and fullscreen preview#3
ignaciotcrespo merged 1 commit into
mainfrom
terminal-graphics

Conversation

@ignaciotcrespo
Copy link
Copy Markdown
Owner

Summary

  • Add detection of terminal graphics protocols (Kitty, iTerm2, WezTerm, Ghostty) with automatic fallback to half-block rendering
  • --screenshot now displays the captured image inline in the terminal using the native graphics protocol at full terminal size
  • New f key in the TUI to view screenshots fullscreen — temporarily exits alt-screen, renders the image using the native protocol, and returns on any keypress

Details

Graphics protocols (Kitty/iTerm2) can't be used inside Bubbletea's alt-screen mode because the escape sequences break the panel layout. The approach taken:

  • TUI panels: always use half-block (safe, works everywhere)
  • Fullscreen mode (f): pauses Bubbletea via tea.Exec, exits alt-screen, renders with native protocol, waits for keypress, resumes TUI
  • CLI --screenshot: renders inline using native protocol at full terminal size

Test plan

  • Run --screenshot <preview> in Kitty/iTerm2/WezTerm — image should render at full terminal size with native quality
  • Run --screenshot <preview> in a basic terminal — should fallback to half-block
  • In TUI, capture a screenshot with s, then press f — should show fullscreen image, any key returns
  • Verify f fullscreen appears in the help bar
  • Verify panels are not broken in normal TUI mode

## Summary
- Add detection of terminal graphics protocols (Kitty, iTerm2, WezTerm, Ghostty) with automatic fallback to half-block rendering
- `--screenshot` now displays the captured image inline in the terminal using the native graphics protocol at full terminal size
- New `f` key in the TUI to view screenshots fullscreen — temporarily exits alt-screen, renders the image using the native protocol, and returns on any keypress

## Details
Graphics protocols (Kitty/iTerm2) can't be used inside Bubbletea's alt-screen mode because the escape sequences break the panel layout. The approach taken:
- **TUI panels**: always use half-block (safe, works everywhere)
- **Fullscreen mode (`f`)**: pauses Bubbletea via `tea.Exec`, exits alt-screen, renders with native protocol, waits for keypress, resumes TUI
- **CLI `--screenshot`**: renders inline using native protocol at full terminal size

## Test plan
- [ ] Run `--screenshot <preview>` in Kitty/iTerm2/WezTerm — image should render at full terminal size with native quality
- [ ] Run `--screenshot <preview>` in a basic terminal — should fallback to half-block
- [ ] In TUI, capture a screenshot with `s`, then press `f` — should show fullscreen image, any key returns
- [ ] Verify `f fullscreen` appears in the help bar
- [ ] Verify panels are not broken in normal TUI mode
@ignaciotcrespo ignaciotcrespo merged commit 81d430d into main Apr 18, 2026
0 of 3 checks passed
@ignaciotcrespo ignaciotcrespo deleted the terminal-graphics branch April 18, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant