A much easier way to install it is to use a package manager such as Homebrew (I believe MacPorts can also install Sleepwatcher, but I’ve only done it with Homebrew). Installing Sleepwatcher from the developer’s site is a bit tricky as it comes with no installer and assumes some knowledge of the Unix command line. An improper configuration could render your machine unable to sleep, wakeup, or even boot, so be sure to carefully test your scripts before enabling them to run automatically. It is also very important to note that you should be extremely careful when implementing these scripts. While the applications will be shut down in a clean manner, you may have unexpected results if the application prompts you to save or to confirm that you really want to quit. The method I’m about to describe works best with applications that save their data files automatically, and exit without user intervention. Sleepwatcher can be run as a system process (always running in the background, even when no users are logged in), as a user process for individual logged-in users, or both.īefore we get too far along, it should be noted that this may not be the best approach for all applications. It can also prevent the machine from sleeping based on the result of a script or it can run a script when another process prevents the system from sleeping. It can monitor for events such as sleep and wake up, display sleep and dimming, and even system idle (a specified period with no keyboard or mouse activity) and power status (when a MacBook switches from AC to battery power and vice-versa). Sleepwatcher is a small daemon process that monitors the sate of your system and kicks off a shell script when certain system events occur. It didn’t take long, however, to find a free third-party utility that does. I’m not so good at this and Apple doesn’t appear to provide a way to do it for me. This generally works great, except that I have to remember to close the programs when I switch machines, otherwise I sometimes end up with unexpected results like locked files or, in some cases, data loss. I have a handful of programs that I run on both my MacBook and Mac Pro desktop at work, using file syncing tools like Dropbox or BTSync to keep the data files up to date on both machines. ![]() This gave me an idea: wouldn’t it be great if I could close certain applications when my commuters go to sleep? I’ve been playing a lot lately with AppleScript and the Mac Automater app, both of which can do some pretty cool stuff.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |