

SleepWatcher (/ ) is an open-source a command-line tool that can automatically execute Unix commands on sleep or wake.
#Sleepwatcher mac mac#
Login items are perfect for opening files and running scripts when you log in to your Mac, but what about actions that need to be performed every time you put your Mac to sleep or wake it up? For example, you might want to mute the volume when you put the computer to sleep and then reconnect to a network drive or virtual private network (VPN) when you wake it up. To remove all global login items, open the Terminal application and type the following command: sudo defaults delete /Library/Preferences/loginwindow AutoLaunchedApplicationDictionary Performing Actions on Sleep or Wake To hide the login item, change the hide value to 1.Įxecute the command again to add another global login item. Replace /path/to/item with the path to the login item. To add global login items, open the Terminal application and type the following command as an administrator: sudo defaults write /Library/Preferences/loginwindow AutoLaunchedApplicationDictionary -array-add

If every user on your Mac needs to have the same login items, where all users share a Mac, you can set global login items for all users on a particular Mac. To remove a login item, select the item, and then click the – button. To hide a login item so it doesn’t appear on the screen when it starts, select the Hide checkbox next to the item. You can select applications, documents, AppleScripts, network drives, and Automator actions.

#Sleepwatcher mac how to#
Here’s how to add login items for an individual user: You can even automatically mount network drives by adding them as login items.Įvery user on your Mac can specify his or her unique login items. In order to solve this problem, I searched for some information on the Internet, and found that some netizens have the same problem as me, and found that the solution is not complete, so here I have compiled a post to help everyone who is as confused as I solve this problem.ġ.Users can add just about anything in a login item everything from applications and documents to custom AppleScripts and Automator actions. The only deviation from the simple instructions was adding SleepWatchers default installation location to my global PATH variable.
#Sleepwatcher mac Bluetooth#
This kind of problem, I found later that sometimes the computer was hibernated, but in the process of putting it in the bag, I touched the mouse, and the mouse was connected to the computer’s Bluetooth directly to wake up the computer, causing the computer to enter the In the open state, there are also times when the Mac connected to the Bluetooth headset is automatically connected to the Mac even if the Mac sleeps, and the wifi needs to be turned off, because sometimes it will prompt a message when it sleeps. I just hibernate the computer after work, but sometimes I find that the computer turns on for no reason. First of all, explain why I want to implement this function, because I use a Mac for office operations, and I don’t like shutting down my computer.
