I am still learning the basics of Cocoa, and I want to build a simple menu extra that puts the display to sleep.
I’ve found a shell the shell commands dim that allows me to set how long to wait before the display sleeps, but the lowest value it will go to is 1 minute. Is there a way to have it sleep immediately?
After reading pmset.c I think that IOKit takes the value in minutes. Another related problem is that iTunes seems to stop playing when the displays goes to sleep - kind of weird for a MediaCenter like setup.
Adam says: The terminal command pmset also takes the value in minutes, but the lowest it will go is 1, not 0 or .1 etc.
See IODisplayWrangler in IOGraphics. References: