Sleep despite annoying clamshell mode
What is a clamshell mode? As per this doc:
You can use an external display or projector with a Mac notebook while its built-in display is closed. This is known as "closed-clamshell" or "closed-display" mode.
Basically, when you're connected with power adapter and there's an external monitor connected, when you close the lid, nothing happens.
But this mode doesn't fit all, and there's still no good solution, and there is no option to turn it off in settings. Some tricks exist, none of them gets you a sleeping machine when just closing the lid:
Some discussion threads from back then and pretty recent as well.
Imagine a magic script that monitors your lid state, and when it is closed, puts your machine to sleep. Here it is!
It periodically checks if lid is closed and puts machine to sleep. Nothing fancy, it uses command line tools that come with OSX, specifically
ioreg, which displays I/O registry and
pmsetto manipulate power management settings.
brew install pirj/homebrew-noclamshell/noclamshell brew services start noclamshell
In case utility didn't work as you expected, you can turn it off:
brew services stop noclamshell brew uninstall pirj/homebrew-noclamshell/noclamshell
Please drop me a note on what went wrong!
I also maintain an utility that reduces the brightness of internal display to zero when lid is open. Appreciate if you check it out!
Author: Phil Pirozhkov
Contributors: - Ben Bosman @benbosman - Ilya Rodionov @ris58h
License: MIT