Skip to content

Tab hover card: page snapshot thumbnails - #33

Merged
ragojose merged 1 commit into
mainfrom
ragojose/tab-hover-site-preview
Aug 12, 2026
Merged

ragojose merged 1 commit into
mainfrom
ragojose/tab-hover-site-preview

Conversation

@ragojose

Copy link
Copy Markdown
Owner

What

Hovering a tab pill now shows a quick visual snapshot of the page at the top of the hover card — like macOS tab previews — above the existing title / host / description / pin+split row. Blank "New Tab" tabs keep their current "Ask anything…" card with no image band.

How

  • New TabThumbnailFetcher (src/tab_thumbnail_fetcher.cc/h): clone of the TabDescriptionFetcher CDP harness, issuing Page.captureScreenshot (JPEG, quality 70). Results route through the existing BroHandler::OnDevToolsMethodResult observer; both fetchers filter by their own pending message id.
  • Capture timing works around windowed CEF's background-tab throttling (inactive tabs are detached + WasHidden(true), so they produce no frames):
    • at switch-away in SetActiveBrowser, while the outgoing tab's compositor surface still holds the on-screen frame (the workhorse);
    • on load-complete of a visible tab (active or split pane);
    • on hover, to refresh visible tabs and best-effort capture never-active background ones.
  • Decode off-main in OnTabThumbnailAvailable (bro_mac.mm) via ImageIO with a 512px cap (~1MB/tab worst case); the NSImage caches on the pill like pageDescription and is cleared when tabURL changes.
  • Card band: 6pt inset, corners concentric with the glass surface, 16:10 aspect-fill center-crop (portrait mobile-emulation captures don't distort). When a capture lands while the card is up it live-fills with the existing description re-spring idiom; failed captures deliver nothing so an older good shot is never clobbered.

Verification

Built with cmake+ninja and drove a live instance headlessly (isolated BRO_USER_DATA_DIR, CDP on 9224, AX-driven — no focus stealing): three tabs on distinct colored pages, six switch cycles, then window screenshots of the card in each state — background tab shows its switch-away snapshot, active tab shows a fresh shot, blank tab is unchanged. No crashes; Page.captureScreenshot confirmed returning data on CEF 151 per-tab targets.

🤖 Generated with Claude Code

Hovering a tab now shows a quick visual snapshot of its page at the top
of the hover card, like macOS tab previews. A new TabThumbnailFetcher
(cloned from the description fetcher's CDP harness) issues
Page.captureScreenshot; since background tabs are detached and hidden,
the workhorse capture happens at switch-away time while the outgoing
tab's compositor surface still holds the on-screen frame, refreshed on
load-complete and hover for visible tabs. Shots are decoded and
downscaled off-main (512px cap), cached on the pill like
pageDescription, and cleared on navigation. The card's snapshot band is
aspect-fill center-cropped (portrait mobile-emulation captures stay
undistorted) and live-fills with the existing re-spring idiom; blank
tabs keep their "Ask anything…" card unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ragojose
ragojose merged commit eb558c9 into main Aug 12, 2026
@ragojose
ragojose deleted the ragojose/tab-hover-site-preview branch August 12, 2026 18:51
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