3

I have a friend who wants his connections (WiFi, Bluetooth, ext...) to turn off when his lid is closed. He doesn't want to change a lot of settings (sleep mode, turning it off manually ...).

Is there a simple way to do this through macOS System Preferences? Or a way with some program?

1

You could install blueutil and SleepWatcher via homebrew and set a .sleep code to call blueutil in order to disable bluetooth and call "networksetup -setairportpower en0 off" to disable wifi when going to sleep mode or closing the lid.

Blueutil comands are "/usr/local/bin/blueutil -p 0" to disable bluetooth and blueutil -p 1 to enable it.

To use SleepWatcher, make a shell script in your home directory named .sleep and give it permission with the chmod command.

You also can do a .wake code to enable back connections when waking up the mac.

You can find out how to use sleepwatcher here

  • 1
    You can do all of this with Keyboard Maestro too, if you prefer a GUI tool. You can have Keyboard Maestro call blueutil and networksetup to control your Bluetooth and AirPort. However, the first thing to do is make sure that “Enable Power Nap” is OFF in System Preferences under Energy Saver. – TJ Luoma Aug 21 at 21:22
0

Would logging out after 5(minimum) minutes of activity work? This can be done in Security and Privacy-> Advanced.

Since both are single toggle methods, disable power nap in energy saver preferences.

  • This does not answer the question. Loging out will close and end all applications and opened documents. The question is specific about not turning off [which is almost the same of logging out from the point of terminating the user applications] and the questinon is specific about WHEN he closes the Lid, so it is not automatic independent from the user control, it is the oposite: is JUST when the user make the ACT of closing the lid. – Prado Aug 9 at 22:33
  • Thanks for the feedback @parado! I am awaiting OP's response over the same too. That's why I ask it as a question. Also, second para achieves what question needs right? Or I am at fault there too? For the "just" of the lid, better if something like AppleScript can be used or third part app for the same. Again, to be specified by OP. – ankii Aug 10 at 5:41
  • Hi, my comment is a positive comment, I don't know for sure you are in fault, but you post it as a answer and I think it should be posted as a comment, your suggestion is good, it just don't fit exactly the OP question as an answer. Also I am new here, and for my understanding we should only post answer if it really fits the question, but as I said, I am not sure. Your comment is going to make me read the rules again, which is good for me to enforce my understanding of the rules for answers and comments. Keep the answer, lets wait for the OP response. – Prado Aug 10 at 10:10
  • I dont listed see what Mac you have. But I have a HP laptop that has a button for airplane mode. When I want to disconnect before I close the lid, I just hit that. Done, no connections. When I come back I open the lid and hit the button again to reconnect and thats it. Maybe the Mac has a simple airplane mode button? – Stumped Aug 21 at 18:46
  • @Stumped I am not aware of that button. Would love to have/know about it. – ankii Aug 21 at 18:47
0

See what I was saying above in comments. I don't have a Mac and do not know if they have it, but I have an HP laptop with airplane mode button on it. When I want to disconnect before I close the lid, I just hit that. Done, no connections. When I come back I open the lid and hit the button again to reconnect and thats it. Maybe the Mac has a simple airplane mode button? You could check and look for it. On the laptop, it is an arrow icon on F12 key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .