ZachsMacTweaks: a one-click macOS system-tweak menu bar app in Swift
ZachsMacTweaks is a native macOS menu bar app that applies common system tweaks with one click — no digging through System Settings, no memorizing defaults incantations. Every change is snapshotted before it’s applied, so anything can be reverted to exactly how it was.
The interesting part isn’t the tweaks — it’s the architecture: a UI-agnostic, fully unit-tested core engine with a thin SwiftUI menu bar app on top, shipped as a notarized .app.
Features
- One-click toggles across Keyboard, Mouse & Trackpad, Finder, Screenshots, Interface, and Accessibility — disable mouse acceleration, remap Caps Lock to Escape, fast key repeat, show hidden files, instant Dock auto-hide, and more.
- Profiles — apply a curated bundle in one click: Focus (grayscale, reduced motion, hidden Dock), Dev Workstation (Caps→Esc, fast key repeat, no autocorrect, visible files), Presentation, Speed Demon, Writer, and Restore Defaults.
- Safe & fully reversible — before mutating anything, the engine reads and stores each original value (or records that the key was unset). Reverting writes the original back, or deletes the key when it never existed.
- Persistent key remaps — Caps Lock remaps use
hidutiland install a per-tweak LaunchAgent so they survive reboots; reverting clears the mapping and removes the agent.
Architecture
The codebase is split into two layers so the engine is testable without ever touching the real system:
TweaksCore— a UI-agnostic Swift package containing theTweak/Profilemodel, the kitchen-sink catalog, snapshot persistence, and the apply/revert engine. Two protocol seams —CommandRunner(shells out todefaults/hidutil/killall) andFileSystem— let the test suite inject mocks and assert on the exact commands and LaunchAgent files produced. No real mutations in tests.- The app — a SwiftUI
MenuBarExtrawindow that drives the engine through an@Observablemodel, reflecting applied state and surfacing errors.
That layered design is the whole point: the safety story (“snapshot every original before mutating it, revert cleanly”) lives in a package with 12 passing unit tests, and the UI is a thin view over it.
Distribution
The app is not sandboxed — it shells out to defaults, hidutil, and killall and writes LaunchAgents, all blocked by App Sandbox — and uses the hardened runtime, so it ships via Developer ID + notarization rather than the Mac App Store. The whole build → sign → notarize → staple pipeline is wired up in a Makefile, with a reproducible Xcode project generated from project.yml via XcodeGen.
Tech Stack
- Language: Swift 6
- UI: SwiftUI (
MenuBarExtra,@Observable) - Core: Swift Package, protocol-oriented seams,
swift-testing - System mechanisms:
defaults,hidutil+ LaunchAgents,killall - Project: XcodeGen (
project.yml) - Packaging: Developer ID + notarization, GitHub Actions CI
Links
- 💻 GitHub →