I built this to solve the very specific problem where every time I disconnected and reconnected my macbook to external monitors, the windows forget their positions.
DockSnap is a lightweight menu bar utility that remembers where my windows were for each display setup and automatically restores them when I reconnect.
- macOS 14 (Sonoma) or later
- Accessibility permission - required to read and set window positions
DockSnap runs in the background as a menu bar app (no Dock icon). It watches for display configuration changes and:
- Captures your current window layout before the change takes effect
- Fingerprints each display setup by screen name and resolution
- Restores the matching saved layout once the new display configuration settles (with a 5-second debounce)
Layouts are stored as JSON in ~/.docksnap/layouts.json, keyed by display fingerprint. Windows are matched first by window ID (same session) and then by title (across sessions).
- Save Current Layout (Cmd+S)
- Restore Layout (Cmd+R)
- Saved Layouts - view, restore, or delete saved configurations
- Launch at Login - toggle auto-start via LaunchAgent
DockSnap is built from source - there's no installer or download. You just need Xcode command line tools.
cd DockSnap/
./build.sh # compiles, bundles into DockSnap.app, and ad-hoc signs it
open DockSnap.app # launches in the menu barOn first launch, macOS will prompt you to grant Accessibility permission. Once granted, DockSnap starts watching for display changes immediately. You can enable "Launch at Login" from the menu bar icon to have it run automatically on startup.
- Swift 5.9 - Swift Package Manager executable
- AppKit - menu bar status item, app lifecycle
- CoreGraphics - display change callbacks, window list capture
- ApplicationServices - Accessibility API for reading/moving windows