Use only your external display while the MacBook lid stays open
— the clamshell effect, without closing the lid.
ClamOpen is a tiny menu-bar app that truly turns off your MacBook's built-in display (backlight off, the compositor stops rendering to it) while an external monitor is connected — with the lid open. The result is identical to clamshell mode, except you keep the webcam, Touch ID, the keyboard, and better airflow.
macOS only powers down the internal panel in clamshell mode (lid closed). If you want to keep the lid open — for the camera, Touch ID, the built-in keyboard, or just cooling — there is no native switch. ClamOpen is that switch.
- 🖥️ One click to turn the internal display off / on from the menu bar
- 🤖 Auto mode — disable the internal display when an external one is connected, restore it when unplugged
- 🔋 Power management — one-click optimization of sleep settings to prevent frequent wake-ups at night (disables TCP Keep Alive, network wake, etc.)
- 🛟 Crash-proof recovery — a standalone Restore app brings the internal display back even if the main app dies (works while the screen is black, via Spotlight)
- 🔒 Safety first — refuses to turn the internal display off when no external display is present; auto-restores on unplug / quit
- 🪶 Menu-bar only (no Dock icon), no background daemon, no permanent system changes
ClamOpen disables the internal panel through a private CoreGraphics / SkyLight symbol:
CGError CGSConfigureDisplayEnabled(CGDisplayConfigRef config, CGDirectDisplayID display, bool enabled);wrapped in a standard display-reconfiguration transaction:
var config: CGDisplayConfigRef?
CGBeginDisplayConfiguration(&config)
CGSConfigureDisplayEnabled(config, builtinDisplayID, false) // false = disable
CGCompleteDisplayConfiguration(config, .forSession)CGBeginDisplayConfiguration/CGCompleteDisplayConfigurationare public CoreGraphics APIs.CGSConfigureDisplayEnabledis the private symbol that does the real work. It is resolved at runtime withdlsym(RTLD_DEFAULT, "CGSConfigureDisplayEnabled")(it ships inside CoreGraphics / SkyLight), so there is no link-time dependency on a private framework and nothing to entitle.- Afterwards the internal display reports
CGDisplayIsActive == false: the backlight turns off and nothing is rendered to it — visually identical to clamshell, lid open. - The
forSessionscope means the change only lasts for the current login session, so a logout or reboot always restores the internal display.
This is the same low-level mechanism behind tools like Lunar and
BetterDisplay. (Apple Silicon additionally offers a
deeper "soft-disconnect" that releases the framebuffer; ClamOpen uses the CGSConfigureDisplayEnabled
path, which works on both Intel and Apple Silicon.)
Verified on macOS 26.5.1 (Intel): disabling returns
CGError 0and flips the built-in display to inactive; re-enabling restores it.
Turning the internal display off and then unplugging the external one could, in theory, leave you with no visible screen. ClamOpen guards against this with several independent layers:
- It refuses to disable the internal display when no external display is online.
- On unplug it auto-restores the internal display via three independent triggers: a low-level
CGDisplayRegisterReconfigurationCallback(fires the instant the cable is pulled), the AppKit screen-parameters notification, and a 1.5 s watchdog. - It restores on quit.
- On Intel, if the panel is occasionally woken at minimum brightness, the watchdog turns it back off within 1.5 s.
Any one of these brings the internal display back:
- Spotlight blind-type (works while black) — press
⌘ Space, type恢复内置屏(the Restore app), press Enter. No need to see the screen. - Unplug the external display — auto-restores.
- Close and reopen the lid — macOS re-enumerates displays.
- Log out / reboot — the
forSessionscope guarantees a restore.
Tested: with the main app not running, launching the Restore app alone brings a disabled internal display back to active.
Requirements: macOS 12+, Xcode / Swift 5.9+.
git clone https://github.com/Attiv/clamOpen.git
cd clamOpen
./build_app.sh # generates icons, builds, and packages both appsThis produces:
ClamOpen.app— the menu-bar app恢复内置屏.app("Restore Internal Display") — the standalone emergency restore app
Or just compile the binaries: swift build -c release
Drag both ClamOpen.app and 恢复内置屏.app into /Applications. Putting the Restore app there
lets Spotlight find it when the screen is black (strongly recommended). First launch may be blocked by
Gatekeeper (local ad-hoc signature) — right-click → Open.
Launch at login: System Settings → General → Login Items → add ClamOpen.app.
- Connect an external display.
- Click the menu-bar icon → Turn off the internal display.
- To bring it back → Restore the internal display, or enable Auto mode.
Problem: MacBook drains battery overnight while sleeping.
Cause: macOS enables TCP Keep Alive by default, which wakes the system every minute to maintain network connections, causing rapid battery drain.
Solution:
- Click the menu-bar icon → Power Management (shows
⚠️ if issues detected) - Review current power settings
- Click Apply Power Saving Settings, enter admin password
- The following will be disabled:
- TCP Keep Alive (prevents frequent wake-ups)
- Wake on Magic Packet (network wake)
- Proximity Wake
- Adjust standby delay to 1 hour
Normal use unaffected: Opening the lid, pressing keys, or clicking the trackpad still wakes the Mac normally.
Verify results: Next morning, run in Terminal:
pmset -g log | grep -E "DarkWake" | tail -20to check if night-time wake-ups have decreased significantly.
Sources/ClamOpen/ Menu-bar app
├── DisplayController.swift Display control (private API calls)
├── PowerManager.swift Power management (sleep optimization)
├── AppDelegate.swift Main app logic
└── main.swift
Sources/ClamRestore/ Standalone emergency restore tool
make_icon.swift Programmatic icon generator
build_app.sh Build + package both .apps
Info*.plist Bundle metadata
scripts/ Dev / verification scripts (probe, toggle test, disable)
- Tested on macOS 26.5.1, Intel (UHD 630 + Radeon Pro 5500M).
- The
CGSConfigureDisplayEnabledpath works on both Intel and Apple Silicon. - Private APIs may change between macOS releases; stable on the above as of writing.
ClamOpen uses a private Apple API. It requires no special entitlements and makes no permanent system changes (the setting is per-session), but private APIs are unsupported by Apple and may change between releases. Use at your own risk.
MIT — see LICENSE.