Sleep display from the command line
June 11, 2014
I like putting my display to sleep when I walk away from the computer. It saves energy, prompts for a password on return and is faster than waking the machine from sleep.
To make the sleeping process faster, I wanted to make an Alfred workflow. The workflow would just run a command in Terminal. The problem? Until OS X 10.9, there was no such command, and now there is!
pmset displaysleepnow
Wham, bam, thank you Mavericks!
Here’s what the workflow looks like:
Dropbox
Or, to create it
-
Click + (bottom left) to create a workflow
-
Inside the new workflow, click + (top right) then Triggers > Hotkey.
-
Enter a keyword. I like dsleep.
-
Click + to add an Action. Choose Run Script.
-
Inside the script’s text field, add
pmset displaysleepnow
. -
Enjoy.
Hey, I'm Ian. I build websites and write about what I learn as I go. Follow me on Twitter.