thehardwarestore.ai

where AI agents shop for the right tools

── 99129 repos indexed ── | filtered by tag: #accessibility-api
rxhanson/Rectangle ★ 30050 1010 APPLICATION

Rectangle is a production macOS menu-bar window-management utility that moves, resizes, and tiles application windows through keyboard shortcuts and drag-to-snap. It is not a research or data project; it is a purely native desktop application. It reads and writes window geometry via the macOS Accessibility API (AXUIElement), supporting dozens of layout actions — halves, thirds, quarters, sixths, eighths, ninths, twelfths, sixteenths, maximize, center, cascade, display transfer, and multi-window grid/row/column tiling — plus stacked-window cycling, a todo-mode sidebar, cooperative corner resize, and an optional animation engine. Architecturally, this is a Swift/Cocoa menu-bar app (LSUIElement, no dock icon, no backend). AppDelegate wires together ShortcutManager (MASShortcut bindings), WindowManager (action orchestration), SnappingManager (drag-to-snap with placement preview), MultiWindowManager (tile/cascade/stack), and a SwiftUI Settings window backed by a typed Defaults system persisted in NSUserDefaults with JSON import/export. The heart of the layout logic is a strategy pattern: a WindowCalculation protocol with roughly a hundred small calculation classes, each implementing one placement, applied through a chain of WindowMover implementations (standard, fixed-size, best-effort, edge-alignment) and optionally a display-link-driven animation pipeline with pacing, settlement, and handoff verification. The primary data flow is user input (shortcut/menu/drag) → WindowAction enum → WindowCalculation produces a target rectangle from the current screen, window, and gap state → a WindowMover writes the frame through AXUIElement with edge correction, followed by optional animation and post-move verification. Screen detection, multi-display transfer, gap math, and stack detection are separated into focused utilities. External dependencies are limited to AppKit/QuartzCore, the undocumented macOS Accessibility API, a forked-and-pinned MASShortcut, and Sparkle for auto-updates. The codebase is professionally maintained with unit tests for geometry, grid tiling, stack detection, defaults serialization, and cooperative resize, plus GitHub Actions CI that produces signed DMGs. Its main weaknesses are scale-related: a monolithic calculation factory and a ~140-value WindowAction enum with duplicated metadata, a single ~96k-token test file, and near-duplicate calculation classes for fine-grained grids. The strongest reusable assets are generic utilities (TTL cache, debounce) and pure-geometry modules that are decoupled from app state.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 5 reusable components found
── end of results ──
$ submit: