How a Screenshot Tool Finds the Window or Button Under Your Cursor

Hover and the right box appears, scroll and it grows a level. How InSnap combines pixel edges, the system window list and accessibility data to find windows and buttons.
In InSnap you do not have to drag a box around a window or a button. You move the cursor, a box snaps to whatever is under it, and the mouse wheel grows that box one level at a time. Behind that are three different sources of information, each with its own strengths, merged into one list of nested boxes.
Source 1: pixel edges
The first source needs nothing from the operating system, so it always works, even on a game or a custom-drawn interface. It looks only at the frozen screenshot.
- Shrink the screen to a brightness grid, at most 900 cells on the long side, built once per capture.
- Mark where edges are, and store running totals so that "how much of this line is an edge?" can be answered instantly for any position and length.
- Test for an edge across two cells, not one. Real window borders are often soft: a translucent taskbar can differ from the page by only about 20 grey levels, and a single-cell jump gets averaged away when the picture is shrunk. Comparing across two cells keeps those edges.
- Grow outward from the cursor in four directions until an edge stops each side. That gives one box. Growing again from just outside it gives the next, and so on.
- Keep only the meaningful levels: those that are clearly bigger, or that newly touch two or more screen edges, which is typical of a window or a content area.
Building the grid for a whole screen takes milliseconds in native code, so it is done directly with no background thread.
Source 2: the system's window list
The operating system knows exactly where each window is. Using that list gives precise edges instead of pixel guesses, and it needs no extra permission. The window under the cursor always becomes one of the levels, and any pixel level that sticks out beyond it is discarded.
Source 3: the interface elements inside a window
Buttons, text fields and groups come from the accessibility interface. On Mac this needs the Accessibility permission; on Windows it uses UI Automation, which needs no prompt.
Two details are worth knowing:
- It is asked in the background. The query goes to the other application, which may be slow, so it runs on a worker thread with a short time limit. The box first appears from the other sources and refines once the answer arrives.
- Some apps hide their contents. Browsers and Electron apps do not build the accessibility tree of a web page until something asks for it. InSnap asks once per app so that page elements can be found.
On Windows the lookup also has to avoid a trap: the screenshot overlay sits on top of everything, so asking "what is at this point?" would only ever find the overlay. InSnap first finds the other app's window at that point in the window list, then searches inside it for the innermost element that contains the point.
How the three are merged
The result is one chain of boxes from innermost to outermost:
- If elements are available and the innermost one is not nearly the whole window, only the element chain is used, so a button stays a button and is not stolen by the edge of an icon inside it.
- If there are no elements, or the app only exposes the window itself (games, custom-drawn interfaces), pixel levels inside the window are added.
- The real window is always one level.
- The last level is the whole screen, so scrolling outward always ends somewhere.
- Levels whose edges are within 1.5 points of each other are merged into one.
The wheel, pinch and Space
- Scroll wheel moves one level outward or inward. A burst of wheel events from one physical notch is combined into a single step.
- Trackpad scrolling and pinch change levels as you move, with about 12% of pinch per level.
- Space jumps between the whole window and the innermost element.

Where it does not help
| Situation | What happens |
|---|---|
| Solid-colour area with no edges | Nothing to detect, so you draw the box yourself |
| Game or custom-drawn interface | Window plus pixel levels, no individual buttons |
| Accessibility permission missing on Mac | Windows and pixel levels only |
| Element changes during the query (a hover menu) | The box may refine after a moment |
FAQ
Do I need to grant a permission for automatic window detection?
Window detection works without one. Finding buttons and fields inside a window uses the accessibility interface, which asks for the Accessibility permission on a Mac.
Why does the box jump to a different size after a moment?
The first box comes from the quick sources. The accessibility answer comes from the other app and can arrive a moment later, at which point the box refines to the exact element.
Does detection send my screen anywhere?
No. The grid and the matching are computed on your computer from the frozen capture and from the window list.
Can I turn automatic detection off?
Yes. It is a setting in the screenshot options, and finding interface elements can be switched off separately from window detection.
More from the blog

How Guide Recording Captures the Screen Before Each Click
Why each step in a recorded guide shows the menu still open: InSnap keeps a few recent frames, picks the one just before your click, and filters drags and double-clicks.
November 10, 2026
How to Screenshot Just One Window (Not the Whole Screen)
Capture a single window on macOS and Windows with the built-in shortcuts, why a hand-drawn box picks up clutter, and how to grab menus that close on a key press.
October 24, 2026
Every Annotation Tool in InSnap, and When to Use It
A quick reference to every annotation tool in InSnap: what each one is for, which are free, which need Pro, and the options worth adjusting.
October 25, 2026
How to Change InSnap's Screenshot Hotkey
The default Command-1 is convenient until it collides with a browser tab. How to rebind capture and pin shortcuts, read conflict warnings, and keep both hands free.
October 25, 2026