Native macOS app for reading and adjusting display brightness. It opens a regular window and also provides a menu bar brightness control.
swift run BrightnessControlApp./build_app.sh
open ".build/release/Brightness Control.app"The build script embeds Resources/AppIcon.icns into the generated app bundle
and applies an ad-hoc signature. To build a universal app for both Apple Silicon
and Intel Macs:
./build_app.sh --arch arm64 --arch x86_64
open ".build/apple/Products/Release/Brightness Control.app"Multi-architecture --arch builds require full Xcode selected with
xcode-select. On a Command Line Tools-only machine, omit --arch for a local
current-architecture build or use the GitHub Actions universal artifact.
APP_VERSION and APP_BUILD_NUMBER can be set to override the values embedded
in Info.plist.
The Build macOS App GitHub Actions workflow runs the core tests and creates a
universal, ad-hoc-signed app archive on every push to main, pull request, and
manual run. Download Brightness-Control-macOS-universal from the workflow run's
Artifacts section.
Pushing a version tag also creates or updates a GitHub Release and attaches the app archive and its SHA-256 checksum:
git tag v1.0.0
git push origin v1.0.0The automated build is not notarized with an Apple Developer ID. After downloading it, macOS may require the first launch through Control-click > Open.
- Internal display brightness uses Apple's
DisplayServicesAPI for writes. - Internal display status reads
corebrightnessdiag status-info. - External display detection uses
system_profiler SPDisplaysDataType -json. - External brightness control uses
m1ddcfirst, thenddcctlwhen installed. - External privacy power-off uses
m1ddc display <n> set standby 5when available, with the app's built-in DDC/CI DPMS writer as a fallback. It does not usedisplayplacer. - Privacy Mode also offers a one-shot action that powers off the external display once without entering the maintained Privacy Mode state, so manually waking the display does not trigger another power-off.
- Lid Sleep Protection registers a protected
SMAppServicelaunch daemon and requires approval in System Settings before external power-off. The daemon holds macOSSleepDisabledonly while an authenticated app session needs it, continuously verifies the state, survives daemon restarts, and restores normal lid sleep after release, app exit, or connection loss. Launch daemons require a signed, notarized application bundle for distribution.
For a local package, build_app.sh uses ad-hoc signing by default; the
installer pins that exact local build's designated requirement and places
the daemon executable in /Library/PrivilegedHelperTools. A normal
SMAppService install fails closed without either that pinned requirement or a
Team ID. Set BRIGHTNESS_CODE_SIGN_IDENTITY to a Developer ID Application
identity and notarize the bundle before distribution.
Install a local build with:
./scripts/install_local_root.sh ".build/release/Brightness Control.app"The script verifies and stages the app in /private/tmp before requesting
administrator authentication, so macOS Documents privacy does not block the
privileged installer. Use --preflight to validate the same staging path
without installing.
- Display state refreshes automatically on launch, app activation, screen changes, wake/session events, and a short background interval. The app does not expose a manual refresh button.
The installed Command Line Tools environment does not include XCTest or Swift
Testing, so this package uses a small executable test runner:
swift run BrightnessControlCoreTestRunner