Many GeekTool 3 users may be annoyed at the fact that Mac machines wouldn’t sleep. So was I and not any more. I got to find solution!

At first, I googled with these keywords: mac +sleep +geektool, and Google led me this page: Sleep Macs via SleepWatcher based on monitor state. But, its contents was out of date. Thd current version is 2.1, and it doesn’t need the StarupItem files. Further to that, it seems to differ from the options of the previous version. So I digged the man page, and made a script with SleepWatcher. Here’s how:

Install sleepwatcher first. Download and install it via bb’s Homepage or Macports with command, “sudo port install sleepwatcher; sudo port load sleepwatcher”

Make a script file somewhere. I named it rc.displaysleep. After made it, make in run with this command: “chmod +x rc.displaysleep ”. Here’s my rc.displaysleep:

#! /bin/sh
#  rc.displaysleep
# When display starts to sleep, the mac will sleep in 60 seconds. 
sleep 60
/opt/local/sbin/sleepwatcher –verbose –now

The SleepWatcher shoud read the rc.displaysleep script when it is loaded. Edit the LaunchDaemons script. I installed via Macports, so I edited the plist file in /opt/local/etc/LaunchDaemons/org.macports.sleepwatcher. If you installed the original version, your plist file shoud be in this path: /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist. Here’s my plist file:

<?xml version=‘1.0’ encoding='UTF-8’?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd” >
<plist version='1.0’>
<dict>
<key>Label</key><string>org.macports.sleepwatcher</string>
<key>ProgramArguments</key>
<array>
        <string>/opt/local/bin/daemondo</string>
        <string>–label=sleepwatcher</string>
        <string>–start-cmd</string>
        <string>/opt/local/sbin/sleepwatcher</string>
        <string>–verbose</string>
        <string>–displaysleep</string>
        <string>/opt/local/etc/rc.displaysleep</string>
        <string>–sleep</string>
        <string>/opt/local/etc/rc.sleep</string>
        <string>–wakeup</string>
        <string>/opt/local/etc/rc.wakeup</string>
        <string>;</string>
        <string>–pid=exec</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><true/>
<key>OnDemand</key><false/>
</dict>
</plist>

Yours may differ from mine.

If you have .sleep and .wakeup file in your home dirctory, then you can execute some programs when Mac sleep or wake up. I made ~/.sleep and ~/.wakeup like these:

~/.sleep:

#! /bin/sh
killall GeekTool

~/.wakeup:

#! /bin/sh
open -a GeekTool

Reboot now, then you Mac sleep well even when GeekTool runs.

Anyway, I hope this post to give a help to you.