Skip to content
ashxudevPublic

About

Remembers your window positions when you disconnect/reconnect your macbook from external monitors

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

DockSnap

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.

Requirements

  • macOS 14 (Sonoma) or later
  • Accessibility permission - required to read and set window positions

How It Works

DockSnap runs in the background as a menu bar app (no Dock icon). It watches for display configuration changes and:

  1. Captures your current window layout before the change takes effect
  2. Fingerprints each display setup by screen name and resolution
  3. 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).

Menu Bar Controls

  • 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

Setup

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 bar

On 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.

Tech Stack

  • 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

About

Remembers your window positions when you disconnect/reconnect your macbook from external monitors

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages