Skip to content
markksantosPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Haze

Dim the distractions. Haze is a lightweight macOS menu-bar app that automatically dims your inactive monitors so the screen you're working on stands out. Move your cursor (or focus a window) onto another display and the overlays follow you.

  • Menu-bar agent — no Dock icon, near-zero idle cost.
  • Follows focus — tracks the cursor, with the frontmost window as a fallback.
  • Per-display control — enable/disable and set a dim level per monitor.
  • Dim-on-idle — optionally dim everything after N minutes of inactivity.
  • Global hotkey — toggle dimming with ⌘⇧D.
  • Launch at login — via the modern SMAppService API.

Architecture

A Swift Package with three targets plus a Next.js landing page:

Sources/
  HazeEngine/   # Pure system logic (no SwiftUI): display + focus tracking,
                #   the dim overlay windows, inactivity + global hotkey.
  HazeUI/       # SwiftUI views + the HazeViewModel that binds engine -> UI
                #   and resolves settings into a DimPolicy.
  HazeApp/      # @main entry point + AppDelegate (owns the engine lifecycle).
landing/        # Next.js 14 marketing site (static export, Three.js hero).
Packaging/      # Info.plist, entitlements, icon, build/DMG scripts.

The engine is dependency-injected through protocols (DisplayProviding, CursorProviding, FrontmostWindowProviding, OverlayWindowFactory, IdleTimeProviding), so all of the core logic is unit-tested with mocks — no real displays required. See Tests/.

Requirements

  • macOS 13 Ventura or later
  • Xcode command-line tools / Swift 5.9+
  • Accessibility permission (granted on first launch) so Haze can read which display the focused window is on. Without it, Haze still follows the cursor.

Build & run (development)

swift build          # build all targets
swift test           # run the test suite (27 tests)
./init.sh            # build + test + launch the raw binary

Running the raw SwiftPM binary works for quick checks, but for the correct menu-bar-agent behavior (no Dock icon, login-item support, icon) build the real .app bundle below.

Build the distributable app

./Packaging/build_app.sh     # -> dist/Haze.app  (ad-hoc signed; runs locally)
./Packaging/make_dmg.sh      # -> dist/Haze.dmg
open dist/Haze.app

For a signed, notarized release suitable for download, and for the Homebrew cask, see Packaging/README.md.

Landing page

cd landing
npm install
npm run dev          # http://localhost:3000
npm run build        # static export -> landing/out/

Deploys to Vercel as a static site (see landing/vercel.json). Set NEXT_PUBLIC_DOWNLOAD_URL to the release DMG URL once a release is published; otherwise the download buttons point at the repo's Releases page.

License

MIT — see LICENSE.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages