t3code icon indicating copy to clipboard operation
t3code copied to clipboard

macOS SnapShot of full-screen Brave captures a stray toolbar strip on another display instead of the window in front

Open MichaelHabermas opened this issue 2 weeks ago • 2 comments

What happened

On macOS with three displays (left external, built-in laptop in the middle, right external), Brave is full-screen on two of them: Google Maps on the built-in display and a YouTube video on the right display. With the Maps window focused, every SnapShot (shortcut) attaches a tiny 142×40 PNG showing a sliver of the YouTube video from the other display. The Maps window is never captured. Five captures in a row did this.

Separately, after switching only the built-in display to the plain desktop (the right display still showing YouTube full-screen) and clicking the desktop, each SnapShot fails with the toast "Snapshot failed — The active window is not available for capture." The user expected the visible screen to be captured.

Diagnosis

macActiveWindow (apps/desktop/src/snapShot/ActiveWindow.ts:61-143) takes the frontmost app's on-screen layer-0 windows in z-order and picks the first that has a title or isn't an untitled strip lined up with a later window (#22624). It ignores focus and display.

Full-screen Brave adds untitled toolbar windows, some not lined up with any content window. Brave's list during triage (front to back):

30616 ""      1920,-40  1920x40   <- picked
30615 ""      0,-75     1920x75
30607/30606/30608 ""  strips at 0,33..148, width 1512
30605 "Google Maps"     0,148  1512x834   <- focused
30971 ""      1512,-98  1920x143
30614 "YouTube"         1512,-98  1920x1080

Displays: built-in x 0-1512, external x 1512-3432 (YouTube), external x -1920-0. Replaying ActiveWindow.ts:120-143 on this list picks 30616, a strip on the YouTube display that matches no later window, so screencapture -l returns a YouTube sliver.

Desktop case: Finder is frontmost with no layer-0 windows (desktop excluded), so captureSource throws window-unavailable (DesktopSnapShot.ts:494-497). A screen-capture fallback would help.

Fix idea: prefer the key window, or the largest on the focused display.

Steps to reproduce

  1. macOS 26.6.2 with at least two displays. Enable SnapShots with Screen Recording and Accessibility granted.
  2. In Brave (Chromium), make one window full-screen (green button) on display A with a YouTube video, and another window full-screen on display B with any page.
  3. Focus the window on display B and press the SnapShot shortcut.
  4. Expected: a full-size capture of the display B window. Actual: a tiny (around 142×40) image that is a sliver of the display A window.
  5. Switch display B to the plain desktop (leave display A full-screen), click the empty desktop, and press the shortcut. Actual: "Snapshot failed — The active window is not available for capture."

Version

T3 Code Desktop 0.1.10-nightly.20261113.4643 (desktop app with a local server), commit 9a35ab0. No commits since this build change ActiveWindow.ts or MacSnapShot.ts; the last change was #22624 on 2026-11-01. (The triage CLI is the same build.)

Environment

macOS 26.6.2 (25.6.0), arm64, three displays (built-in 1512×982 plus two 1920×1080 externals). Brave Browser windows in macOS full-screen Spaces.

Evidence

- Five 142×40 attachments showing the YouTube video from the other display, taken while the Google Maps window was focused.
- `desktop.trace.ndjson`: four `desktop.snapShot.shortcutActivated` failures at 2026-11-14 15:57:40–15:57:54 UTC, each `DesktopSnapShotError: The active window is not available for capture.` raised from `captureSource`.
- Repro again 16:12 UTC: another 142x40 YouTube sliver, source name "Brave Browser" (untitled window picked).
- The window list above, and a replay of the `ActiveWindow.ts` selection on it, which picks 30616.

Related issues

  • #16077 (closed), the helper-window bug fixed by #22624. This is a case that fix misses: strips that don't line up with the content window.
  • #33947: the same picker selects a small titled sharing-indicator window.
  • #31566: macOS SnapShot and full-screen Spaces across several displays.

Fix applied or workaround

Maximize instead of macOS full-screen (Option-click green button).

Filed by

Filed via T3 Code triage by Claude Code (Claude Opus 5.5, claude-opus-5-5).

MichaelHabermas avatar Nov 14 '26 16:11 MichaelHabermas

1-snapshot-failed-toast 2-wrong-capture-142x40

Screenshots: the error shown on the plain desktop, and one of the 142×40 captures taken while Google Maps was focused.

MichaelHabermas avatar Nov 14 '26 16:11 MichaelHabermas

I tried to reproduce this on the current build and could not.

No macOS worker exists, so the desktop app could not be run as the reporter did. On origin/main be2a287952 I added a case to apps/desktop/src/snapShot/ActiveWindow.test.ts that feeds macActiveWindow the reporter's Brave window list (full-screen strips at 1920,-40 and 0,-75, strips above 'Google Maps' 0,148 1512x834, then a 1920x143 strip and 'YouTube' 1512,-98 1920x1080) through the mocked osascript lookup. vp test run src/snapShot/ActiveWindow.test.ts fails with expected 30616 to equal 30605: the picker returns the untitled 1920x40 strip on the other display instead of the focused Google Maps window. The other 16 tests pass. This matches the reporter's five 142x40 captures. Pushed as factory/repro-36814 (dabd703be7). The desktop-click case ('The active window is not available for capture.' when Finder has no windows) is the window-only design giving a clear error, so it was not treated as part of this bug.

Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

juliusmarminge avatar Nov 14 '26 16:11 juliusmarminge