MacBook Air/Pro: run script upon lid close?
10
votes
4
answers
7530
views
How can one configure MacOS (10.8 or higher) to automatically and immediately call a user-designated script (probably a bash script) upon the user closing the display lid of a MacBook Air or Pro?
Details.
I want to do this because in some scenarios my MacBook Air 2013 running 10.8.5 does not immediately sleep/lock the screen upon lid close (possibly because a VPN client is trying to open a connection). As such, I want the system to immediately execute a script which calls [this screen-saving-and-locking procedure](https://apple.stackexchange.com/a/80061/13179) upon lid close. However, I don't know how to call scripts upon display-lid closing.
Asked by Johnny Utahh
(1299 rep)
Oct 7, 2013, 01:39 AM
Last activity: Feb 12, 2025, 06:38 AM
Last activity: Feb 12, 2025, 06:38 AM