Tuesday, January 31, 2023

Reverse Engineering the MacBook Clamshell Mode

Alin Panaitiu:

You notice you never use the MacBook built-in display anymore, and it nags you to have it in your lower peripheral vision.

Closing the lid is not an option because you still use the keyboard and trackpad, maybe even the webcam and TouchID from time to time.

[…]

Why isn’t there a way to actually disable this screen?

[…]

In the pre-chunky-MacBook-Pro-with-notch era, the lid was detected as being closed using magnets in the lid, and some hall effect sensors. So you were able to trick macOS into thinking the lid was closed by simply placing two powerful magnets at its sides.

[…]

I usually search for code on SourceGraph as it has indexed some large macOS repos with dyld dumps. Looking for RequestClamshellState gives us something far more interesting though[…]

But to call the private API he needed private entitlements, which must be signed by Apple, unless that check is disabled after turning off System Integrity Protection. Even then he ran into a blocker. Still, it’s an interesting tour through how to dig into macOS.

4 Comments RSS · Twitter · Mastodon


SwitchResX has a checkbox in its' menubar app for "enable this screen" for each scren connected to the machine. Presumably it could be used to disable and enable the built-in display at will... unless there's something funky about the built-in screen as compared to an external.


Sorry if this is a dumb question, but why can't you just turn the brightness of the display all the way down? As far as I can tell, turning the brightness of the internal display down to its minimum turns it off so at least it won't be in your peripheral vision.


@Dark Turning down the brightness doesn’t prevent windows from opening on the display.


@Michael if you enable mirroring (and choose the external display to have the correct resolution) it should be fine to ignore the builtin display.

Leave a Comment