Skip to content
markksantosPublic

Repository files navigation

📌 Anchor

Anchor icon

Pin live screen regions as floating, always-on-top overlays on macOS.

Swift SwiftUI macOS License

Features · Getting Started · Tech Stack


Features

  • Live Region Pinning — Select any screen region and pin it as a real-time floating overlay that continuously updates
  • Global Hotkey — Trigger selection anywhere with Cmd+Shift+A, no need to focus the app
  • Always-on-Top Panels — Pinned regions float above all windows and persist across spaces
  • Window-Anchored Mode — Automatically detects the source window and follows it when moved, with "Source lost" recovery on minimize/restore
  • Multiple Anchors — Run as many simultaneous live overlays as you need, each fully independent
  • Adaptive FPS Throttling — Automatically scales refresh rate based on active anchor count (15 → 10 → 5 FPS)
  • Resize Handles — Drag edges and corners to resize any panel, with an 80×80 minimum
  • Opacity Control — Hold Cmd and scroll to adjust panel transparency from 10% to 100%
  • Context Menu — Right-click any panel to copy the current frame, save it to the Desktop, zoom in/out, reset size, set an opacity preset, or close
  • Settings — Configurable launch-at-login, default opacity for new anchors, live permission status, and a shortcuts reference
  • Menu Bar Native — Lives entirely in the menu bar with an active anchor counter, no Dock icon

Getting Started

Prerequisites

  • macOS 13.0 (Ventura) or later
  • Swift 5.9+ / Xcode 15+

Installation

git clone https://github.com/markksantos/Anchor.git
cd Anchor
swift build
swift run

Or build the .app bundle:

bash Scripts/bundle.sh
open build/Anchor.app

Development

swift build          # debug build
swift test           # run the unit test suite (pure geometry/throttling logic)
swift run            # launch from the command line

For Gatekeeper-clean distribution, sign the bundle with a Developer ID:

SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" bash Scripts/bundle.sh

then notarize (see comments in Scripts/bundle.sh).

Permissions

Anchor requires two macOS permissions on first launch:

  1. Accessibility — For the global hotkey (Cmd+Shift+A). macOS will prompt automatically.
  2. Screen Recording — For live screen capture. Grant in System Settings → Privacy & Security → Screen Recording.

How It Works

Write-up: CGWindowListCreateImage unavailable in macOS 15: use SCStream — the capture API this app uses, why macOS 15 removes it, and the ScreenCaptureKit replacement.

Tech Stack

Component Technology
UI Framework SwiftUI (MenuBarExtra) + AppKit (NSPanel, NSView)
Screen Capture CGWindowListCreateImage
Refresh Loop DispatchSourceTimer
Global Hotkey CGEvent.tapCreate
Image Display CALayer.contents
Window Tracking CGWindowListCopyWindowInfo polling
Launch at Login SMAppService (ServiceManagement)
Build System Swift Package Manager
CI GitHub Actions (build + test + bundle + release)
Target macOS 13.0+

Project Structure

Anchor/
├── Package.swift
├── .github/workflows/ci.yml
├── Scripts/
│   └── bundle.sh
├── Sources/Anchor/
│   ├── AnchorApp.swift          # @main entry point + menu bar
│   ├── AppState.swift           # observable app state
│   ├── SettingsView.swift       # Settings scene (launch-at-login, opacity, permissions)
│   ├── Geometry.swift           # pure coordinate / throttling helpers (unit-tested)
│   ├── Info.plist
│   ├── Capture/
│   │   ├── ScreenCaptureEngine.swift
│   │   └── WindowTracker.swift
│   ├── HotKey/
│   │   └── GlobalHotKey.swift
│   ├── Manager/
│   │   └── AnchorManager.swift
│   ├── Panel/
│   │   ├── AnchorPanel.swift
│   │   ├── AnchorPanelContent.swift
│   │   └── PanelContextMenu.swift
│   └── Selection/
│       ├── SelectionOverlay.swift
│       └── SelectionView.swift
└── Tests/AnchorTests/
    └── GeometryTests.swift

License

MIT © 2026 Mark Santos


Built with ❤️ by NoSleepLab

Releases

Packages

Contributors

Languages