Skip to content
markksantosPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Unplug

A lightweight macOS menu bar app that remembers your window layouts for each display configuration and restores them automatically when you connect or disconnect monitors. Dock your MacBook and every window snaps back exactly where it belongs.

  • Auto-restore — reconnect a display and windows return to their saved spots.
  • Per-display memory — each monitor configuration gets its own remembered layout.
  • Stable display fingerprinting — matches monitors by EDID (manufacturer, model, serial), so it survives port changes and reboots.
  • Resolution-change aware — scales window positions/sizes proportionally.
  • Private — no accounts, no analytics, no network calls. Data stays in ~/Library/Application Support/Unplug/configurations.json.

Requires macOS 13 Ventura or later (Apple Silicon or Intel).

Repository layout

Sources/
  UnplugEngine/   Display fingerprinting, detection, capture, restore, persistence
  UnplugUI/       SwiftUI menu bar popover, settings, onboarding, shared AppState
  UnplugApp/      @main app entry + AppCoordinator wiring engine to UI
Tests/            XCTest suites (19 tests: engine + UI + end-to-end)
scripts/          generate_icon.swift (programmatic app icon)
landing/          Next.js 15 marketing site
init.sh           Build + test + bundle + (optional) sign/notarize/DMG
Unplug.entitlements  Hardened-runtime entitlements for notarization

Build & run (the app)

# Build, test, and bundle build/Unplug.app (unsigned, for local use)
./init.sh

# Install and launch
cp -R build/Unplug.app /Applications/
open /Applications/Unplug.app

On first launch Unplug asks for Accessibility permission (System Settings → Privacy & Security → Accessibility). It needs this to read and move windows; it never reads window contents and nothing leaves your Mac.

Just the Swift package

swift build      # compile
swift test       # 19 tests

Build & run (the landing site)

cd landing
cp .env.example .env.local   # then fill in NEXT_PUBLIC_BUY_URL etc.
npm install
npm run dev                  # http://localhost:3000
npm run build && npm run start   # production

The site's CTA links are configured entirely through NEXT_PUBLIC_* environment variables (see landing/.env.example and landing/src/lib/config.ts) — no code changes needed to point "Buy Now" / "Download" at a real Gumroad or Stripe link.

Distribution (Developer ID)

The app is distributed outside the Mac App Store, so it needs a Developer ID signature + Apple notarization. init.sh automates this once you have a certificate:

# Sign with Hardened Runtime + Unplug.entitlements
SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" \
  ./init.sh --release --sign

# Build a signed, notarized, stapled DMG (uses a notarytool keychain profile)
SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" \
NOTARY_PROFILE="unplug-notary" \
  ./init.sh --release --notarize

The App Sandbox is intentionally not enabled: positioning other apps' windows via the Accessibility API is incompatible with sandboxing for a Developer-ID utility. Hardened Runtime is still on for notarization.

How it works

  1. DisplayDetector registers a CGDisplayRegisterReconfigurationCallback and debounces display changes.
  2. DisplayFingerprint builds a stable per-monitor ID from EDID (falling back to resolution when no serial is present); the set of fingerprints forms a configurationID.
  3. On a known configuration, LayoutRestorer moves each window back via the Accessibility API (matching by bundle ID + title, with scaling + offscreen clamping). On an unknown one, LayoutCapture snapshots the current layout and ConfigStore persists it (max 20 configs, oldest pruned, JSON on disk).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages