Repository navigation
[Bug]: macOS SnapShots capture a helper window instead of the real one, giving tiny images for Chrome and Electron apps #16077
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
- On macOS, enable SnapShots with Screen Recording and Accessibility granted.
- Bring forward an app that keeps thin helper windows on the normal window layer in front of its main window. Chrome did this on my machine (window list below), and so do Electron apps.
- Take a SnapShot with the shortcut.
Expected behavior
The SnapShot shows the window I was looking at, at full size.
Actual behavior
The SnapShot is a tiny, unreadable image. Taking a SnapShot of an Electron app's main window from T3 Code Nightly gave a 51×32 PNG of the whole window. The attachment metadata named the right app and window title, but the image was too small to read. A screenshot is in the comments.
Cause, from reading the code:
-
macActiveWindowinapps/desktop/src/snapShot/ActiveWindow.tsruns a JXA script. The script returns the frontmost app's first on-screen window withkCGWindowLayer === 0, in front-to-back order. -
Some apps list untitled helper windows first. This is Chrome's on-screen layer-0 list from my machine, front to back:
id title x y width height 75 "" 0 39 1800 41 74 "" 0 80 1800 81 1691 "" 0 39 1800 158 71 "(10) … - YouTube" 0 161 1800 1008 <- the real windowThe lookup returns window 75.
-
captureMacWindowSnapshotcapturesscreencapture -l <id>and then scales the image down to fitsnapShotThumbnailSize(active), which comes from the chosen window's bounds. When the chosen window is a strip or a tiny helper, the result is a strip or a thumbnail.
How this was established: I hit it in a downstream fork that shares this code path. There, ActiveWindow.ts and MacSnapShot.ts are identical to main apart from comments. The 51×32 capture above came from stock T3 Code Nightly. The Chrome window list came from running the same CoreGraphics query directly. I did not take a T3 SnapShot of Chrome in that state, and I did not identify which window gave the 51×32 bounds in the Electron case. Chrome does not always order its windows this way: #10896 shows a Chrome capture that picked the right window.
Impact
Major degradation or frequent failure
Version or commit
T3 Code Nightly 0.0.46-nightly.20261005.2667. Code read at main @ 1a3f7ad.
Environment
macOS 27.0.1, Apple Silicon
Logs or stack traces
No response
Workaround
None for the user. In the fork, the JXA script now returns every on-screen layer-0 window of the frontmost app, with its title, bounds and kCGWindowAlpha. A small TypeScript function picks one:
const MIN_MAC_WINDOW_SIDE = 100;
export function pickMacActiveWindow(windows) {
const visible = windows.filter((window) => window.alpha > 0);
const titled = visible.find(
(window) =>
window.title.trim() !== "" &&
window.bounds.width >= MIN_MAC_WINDOW_SIDE &&
window.bounds.height >= MIN_MAC_WINDOW_SIDE,
);
if (titled) return titled;
// No titled window, for example without Screen Recording: take the largest.
return visible.reduce(
(largest, window) =>
!largest ||
window.bounds.width * window.bounds.height > largest.bounds.width * largest.bounds.height
? window
: largest,
undefined,
);
}With the whole list in the output, maxBuffer also needs raising from 64 KiB. I used 1 MiB. Moving the choice into TypeScript also lets it be unit-tested without osascript.
Related: #12103 is a different failure in the same lookup (frontmostApplication reports PID -1 for Device Hub).
Investigated and drafted with Claude Code (Claude Opus 5.5).
Activity
rithwikshetty commentedon Oct 5, 2026
This is how it looks when I snapshot t3code
juliusmarminge commentedon Oct 5, 2026
Note
Grok responding on behalf of Julius.
Triage
Thanks for the detailed write-up and the Chrome window list, @rithwikshetty. The ordering evidence and the pointer into
macActiveWindowmade this straightforward to follow.What I found
mainat1a3f7ad508,macActiveWindowreturns the frontmost app's first on-screen layer-0 window, front to back (apps/desktop/src/snapShot/ActiveWindow.ts).captureMacWindowSnapshotthen runsscreencapture -lon that id and scales the PNG down tosnapShotThumbnailSize(active), which is the chosen window's bounds (capped at 2560×1600).screencapturereturned the whole window. That matches the composer image you attached.maxBufferthan the current 64 KiB, but that buffer is not what failed here.MacSettingsWindowalready ignores windows under 500×350, but only while looking for System Settings' one content window.Likely fix area
pickMacActiveWindowsketch), preferring a titled window above a minimum size, or falling back to the largest visible window.maxBufferabove 64 KiB so large window lists do not truncate.A maintainer will decide on the fix direction.
AlexHoff97 commentedon Oct 7, 2026
I have this exact issue as well.
pnachtlberger commentedon Oct 17, 2026
Another data point, still present in T3 Code Nightly 0.1.1-nightly.20261016.3203 (macOS 26.5.2). It happens reliably when Chrome is in native fullscreen; the same window captures fine when not fullscreen. The SnapShot is a 36×20 image of a window titled "Window" (AX:
WindowSharingSessionButton).Chrome's on-screen layer-0 windows in fullscreen, front to back:
Today's lookup returns 5847. The alpha > 0 filter plus the full-width strip check in #12978 would skip 5847, 594 and 679 and pick 591, so that PR covers this fullscreen case too.
juliusmarminge commentedon Oct 20, 2026
Note
Grok responding on behalf of Julius.
Fixed by #12978, which just landed on
main. The macOS SnapShot lookup now considers all of the frontmost app's layer-zero windows and skips transparent windows and thin untitled strips in front of the content window, so Chrome and Electron helper strips no longer win.@pnachtlberger, your Chrome fullscreen case picked a small titled window ("Window", 36×20), and titled windows keep their ordering in this fix, so it may not be covered. If it still happens on the next nightly, please open a new issue with that window list and we'll track it separately.