← All work
NATIVEShipped2024

dockPeek

A native macOS utility — hover over a Dock icon to instantly preview thumbnails of every open window for that app. Works across Spaces and full-screen.

Role
Lead + native development
Duration
2024
Reading
1 min read
Stack
SwiftSwiftUIAppKitAXUIElementScreenCaptureKit

Product Shots

SCREENSHOTS · COMING SOON

Screenshots coming soon. Drop captures into public/works/<slug>/ and add a screenshots array to the mdx frontmatter.

public/works/dockpeek/01.png

The most common complaint from Windows-to-Mac switchers: the Dock can't preview windows like the Windows taskbar. dockPeek fixes that — hover a Dock icon for half a second, and a panel of live thumbnails of every window for that app appears. Click goes straight to the window.

Problem

  • macOS Dock only switches apps, not individual windows
  • Mission Control is heavy and not "instant"
  • Most third-party tools rely on private APIs and break on every macOS update

Solution

Pure public APIs + high-performance capture:

  1. AXUIElement Dock observation: Accessibility API detects which Dock icon the cursor is on — no polling, no CPU waste.
  2. ScreenCaptureKit thumbnails: macOS 12.3+ official API, 5x faster than the legacy CGWindowListCreateImage and Retina-aware.
  3. SwiftUI preview panel: NSPanel (not NSWindow) avoids stealing focus; CALayer transforms power smooth entry animation.
  4. Spaces / Mission Control aware: Lists windows from other Spaces too, and clicking switches Spaces.

Stack

  • UI: SwiftUI 5 + AppKit (NSPanel)
  • Accessibility: AXUIElement API
  • Screen capture: ScreenCaptureKit (macOS 12.3+)
  • Window management: CGWindowListCopyWindowInfo + Spaces API

Outcomes

  • Working release shipped
  • Integrates seamlessly with native Dock behavior
  • 60fps preview, < 2% CPU at idle
  • Public APIs only — high forward compatibility with macOS updates

Lessons

  • AXUIElement is the hidden gem of Mac automation: Many people assume Dock interaction needs private APIs — the public AX API is enough.
  • ScreenCaptureKit is a game-changer: Way faster than the old API, native multi-display + Retina support. Most "laggy Mac utility" complaints went away after this API shipped.
  • NSPanel vs NSWindow: For floating UI, NSPanel is the right choice. NSWindow steals focus and breaks the Dock interaction.

Interested in this project?

Or want something similar built? Let's chat.