Sunday, April 26, 2009

Lock the screen and turn off iMac display

Here's how I got my iMac to (effectively) lock the screen and sleep the display:
  1. Get Spark (for the keyboard shortcut)
  2. Get SleepDisplay (to sleep the display)
  3. Check "Require password to wake this computer from sleep or screen saver" in System Preferences->Security->General
  4. Create a new AppleScript Action in Spark with the following code:
do shell script "/Applications/SleepDisplay.app/Contents/MacOS/sleepdisplay"
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -module 'Computer Name'"

If you don't need to sleep the iMac display (have an external monitor with a power button), you can do this:
  1. Check "Enable fast user switching" in System Preferences->Accounts->Login Options
# This brings up "switch users", but doesn't keep the display killed
do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"

No comments: