Problem: Display goes to sleep and won't come back. Moving the mouse makes the screen brighten like it has returned but the screen is still black.
Solution: I noticed that changing the screen resolution and then changing it back makes the screen return. You can easily test if this hack/workaround will work for you. Here's how.
Open up your Display properties, click your screen resolution to highlight it. Now wait for the screen to sleep (I recommend setting it to sleep the display after 1 minute to speed this up). Now once the screen goes blank move your mouse, it should brighten but still be black. Hit the up arrow on your keyboard, it should change the screen resolution and return the screen. If that worked, this hack will work for you.
All we're going to do is change the screen resolution and then change it back when the wakeup command is sent. For that we need 2 packages. (link to zip below)
Cscreen - command line utility to change the screen resolution
Sleepwatcher - command line daemon to execute commands on sleep or wakeup (highly configurable)
The installation instructions are also included in the zip file. I've pasted them here for reference. Sorry if my instructions are hard to follow, if you can write a better set please do.
OSx86 Monitor Refresh Workaround.
If your notebook goes to sleep and wakes up properly but the monitor doesn't come back this is for you. If your computer won't return from sleep or you have other sleep related issues this is NOT for you.
I found that changing the screen resolution actually wakes up the screen. This package just runs a command line app (cscreen) on wakeup to change the screen resolution back and forth to refresh the display.
1. Double click cscreen.dmg. Move the cscreen binary to /usr/bin. From the terminal
mv /Volumes/cscreen/cscreen /usr/bin
chown root:wheel /usr/bin/cscreen
chmod 755 /usr/bin/cscreen
2. Double click sleepwatcher_2.0.5.dmg. Install sleepwatcher.pkg and SleepWatcher StartupItem.pkg
3. In terminal, we need to modify the startup item for sleepwatcher.
<enter your password>
nano -w /Library/StartupItems/Sleepwatcher/Sleepwatcher
Scroll down to line 18, it looks like this:
/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup
Change it to look like this:
/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -W /etc/rc.wakeup
** NOTICE: The only change is changing the lower case 'w' to an uppercase 'W' **
Scroll down to line 28 (it's identical to the one above) and do the same thing.
Save and exit
4. Next we need to make the wakeup file for sleepwatcher to use
nano -w /Users/YOUR-USER-NAME/.wakeup
Substitute YOUR-USER-NAME with your home folder name.
In .wakeup put this:
#Begin wakeup script
cscreen -d 16 -x 1680 -y 1050 && cscreen -d 32 -x 1680 -y 1050
#End wakeup script
cscreen is a command line utility to change screen resolutions, all we need to do is get it to refresh the screen. We can do that easily by just changing it from 32bit color (Millions of colors) to 16bit (Thousands of colors) and back to 32 bit again. Substitute your screen resolution after the -x and -y flags, leave the -d flag alone. (Mine was 1680x1050)
Save and exit.
5. the .wakeup file has to be executable.
chown root:wheel /Users/YOUR-USER-NAME/.wakeup
chmod 755 /Users/YOUR-USER-NAME/.wakeup
6. Thats it you're done. If everything was done right it should work. You can test this by setting the display sleep time to 1 minute and then wait for the display to turn off. If everything was done right when you move the mouse your screen should flicker a little and then come back.
The screen flickers for a moment and then returns while it swaps resolutions, not a big deal really. It also does the flicker/refresh on boot because the daemon launches the script on boot. This is just a minor annoyance really and is hardly noticeable.
If anyone cares to clean this up, improve it, turn it into a package go for it. Its not very elegant but it works. Sleepwatcher is highly configurable and can execute all sorts of commands on sleep, wake up, display wake up, display sleep, etc .. You could probably pair this with a nice clean applescript that does the same thing cscreen does. I hope someone smarter than me comes up with a more elegant solution.