Shift + Control + Eject will turn off a Mac's display.
I just bought a new MacBook Air. It has a power button instead of an Eject key:
Besides a hot corner or turning down the screen brightness, is there a keystroke that will sleep the display?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityShift + Control + Eject will turn off a Mac's display.
I just bought a new MacBook Air. It has a power button instead of an Eject key:
Besides a hot corner or turning down the screen brightness, is there a keystroke that will sleep the display?
Just Shift + Control + Power works on my retina MBP, which also doesn't have an eject button.
http://dl.dropbox.com/u/18414/ase/DimScreen.tar.bz2 is my attempt at a solution to this.
It is an Automator Application which does two things:
It runs a script to dim the screen to 0 (see note below)
It launches your screensaver.
Why does it launch your screensaver? Well, because I assume that if you are dimming your screen that means you are going to be gone from it for awhile.
If the brightness is set to 0 and you come back to your Mac and press some keys, move the mouse, etc nothing will happen. Well, nothing you can see.
However if the screensaver is running, the Mac is smart enough to bump up the brightness just a litte to show you that you need to enter your screensaver password.
(You DO require a password to unlock your screensaver, right?)
Well, even if you don't, you can still use the app. After the screensaver exits, the script will bump the brightness back up just a little.
(If you find that the screensaver is being turned off by accident and you don't want that, you can just edit the last few lines of the script, and copy/paste it into a new app.)
dimscreen.zsh
is the script which is run by the application (it is part of the .tar.bz2 file). HOWEVER this script depends on the 'brightness' command being present at $HOME/bin/brightness, which it probably is not.
If the app does not find it there, it will attempt to download it from http://luo.ma/attic/brightness.bz2 and install it to ~/bin/brightness.
If the idea of downloading a file from the Internet skeevs you out, you can find the source code at http://mattdanger.net/2008/12/adjust-mac-os-x-display-brightness-from-the-terminal/ and compile your own (that page has instructions, it is dead simple).
I have included the source code as well as the precompiled binary in the .tar.bz2 file as well.
(As for the "Keyboard Shortcut" part of your question, I leave it to you to decide which of the many app launchers you will use, including something like Apptivate which can tie it to a single keystroke if you like.)
Though the question explicitly says "besides a hot corner", I'll mention it since it's the only way I've found so far to get display sleep at all on the new Air.
Open Preferences, go to "Desktop & Screen Saver", choose the "Screen Saver" tab, click "Hot Corners…". Open the dropdown for the corner you'd prefer and pick "Put Display to Sleep".
If you move the mouse cursor to that corner, the display will go to sleep.
If you hold Cmd (or some other modifier, or combination of modifiers) and then open the dropdown, display sleep will only trigger if you move the mouse and hold that modifier, which could reduce mistakes.
The free app Sleep Display works fine on my Air, running OS X Lion. It's just a SleepDisplay.app that does what it says.
I just launch it by name via Alfred, but you could probably bind it to keyboard shortcuts with any of a number of tools, like FastScripts.
This isn't a keystroke, but it's a step in the right direction: If there were a way to get past the fact that the script needs to be run with sudo, you could use Automator to bind it to a keyboard shortcut:
#!/bin/bash
original_setting=`/usr/bin/pmset -g | /usr/bin/grep displaysleep | /usr/bin/awk '{print $2}'`
echo $original_setting
magic_number=2147483648
/usr/bin/pmset -a displaysleep $magic_number; sleep 1; /usr/bin/pmset -a displaysleep $original_setting
The eject key is now on the F12 key. Give Shift+Control+F12 a try.
There is a keyboard shortcut already mapped in the OS for doing this, you don't need to map anything or write any scripts.
Sleep all displays: Control+Shift+Fn+Power Button
Works on Mountain Lion and Mavericks (possibly others as well). It works on my MacBook Air running Mavericks (10.9.2).