Making the monitor go to sleep?

cerbero

Registered
I was wondering if it's possible to make the monitor go to sleep with a Terminal command.. I have my computer in the same room I'm sleeping, and I have it on all the time, so I don't want the monitor on when I'm sleeping (I have an eMac). Right now I have to go to System Prefs' Energy Saver pane everytime I go to bed. And even then I have to wait 5 minutes for the monitor to sleep, so it would be great if I could do this with just a click whenever I need it..
It doesn't have to be a Terminal command, just some, easy way to do it will be nice :)

Thanks.
 
If you can find the AppleScript command that triggers a Sleep (I have a feeling it might be in finder or something) then I guess you could whip up an AppleScript and just launch it from a shell-script using the 'open' command. Alternately, find the config file that holds your sleep setting, and set up a script to alter/change it.

I guess not many people put their computer to sleep through a remote terminal. You do know that, at the computer itself, you only have to choose sleep from the apple menu, or press Power -> S. But then, you wouldn't be asking unless you wanted a way to do it remotely.
 
Originally posted by symphonix
If you can find the AppleScript command that triggers a Sleep (I have a feeling it might be in finder or something) then I guess you could whip up an AppleScript and just launch it from a shell-script using the 'open' command. Alternately, find the config file that holds your sleep setting, and set up a script to alter/change it.

I guess not many people put their computer to sleep through a remote terminal. You do know that, at the computer itself, you only have to choose sleep from the apple menu, or press Power -> S. But then, you wouldn't be asking unless you wanted a way to do it remotely.
I'm looking for a way to put only the monitor to sleep, not the entire computer. Main thing is I don't want to have to wait 5 minutes before it does, and not have to change the energy settings every night.
 
I'd suggest opening up the plist for energy saver (you'll find it in /Library/Preferences/com.apple.PowerManagement.plist), and finding the entry for the monitor sleep. It is possible to literally edit "MinutesUntilDisplaySleeps" down to 1 minute, even though you can't do this through the pref pane. (you can't go lower as the field is an integer)

You'd create a "standard" copy of this file somewhere safe, and then a "modified" copy as well.

Then, you'd come up with a script that copies a standard energy plist into place, and another that copies your modified one into place. I'm thinking basic shell scripts, here.

You'd run one script to put your display to 1-minute-sleep, and another to put it back to normal. You might need to call something to get it to refresh its prefs, such as the prefs pane.
 
Back
Top