SnapWM

Solo developer · 2023

  • Swift
  • SwiftUI
  • Accessibility API
  • CGEvent Tap

Problem

macOS has no first-party window-snapping beyond the basic split-view gesture. SnapWM adds grid-based snapping and keyboard-driven window placement for people who want more control than the OS gives out of the box.

Constraints

  • No public “move this window” API on macOS — window manipulation has to go through the Accessibility API, which is permission-gated and not designed for high-frequency use.
  • Needed to detect drag gestures and keyboard shortcuts system-wide without a kernel extension, which meant a CGEvent tap running under Accessibility permissions rather than anything sandboxed.

Architecture

Architecture diagram — available on request

A SwiftUI menu-bar app owns configuration and the snap-zone overlay UI. A CGEvent tap listens for drag and keyboard events system-wide; window moves and resizes are then applied through the Accessibility API (AXUIElement) against the focused window.

Stack

Swift, SwiftUI, macOS Accessibility API, CGEvent tap.

My role

Solo project — design, implementation, and working through AXUIElement’s quirks across macOS versions.

Outcome

A working daily-driver window manager, built primarily to fix how macOS handles multi-window workflows for my own use.