Dim_Face
This is just a description of something I thought was cool;
while it isn't likely to horribly break anything,
this is JUST a description, not a prescription. This is a piecemeal solution, using components from various sources. The components are the property of their respective creators. Be sure to respect any licensing associated with the software components. ConceptPicture yourself sitting in front of your computer (crazy, right?).
OK, so it isn't the end of the world, but we should be able to do better than this. Isn't there some way to tell if you're in front of the computer, but not typing? Well, here's one way: if the mouse and keyboard aren't being used, use the camera to briefly look for faces facing the screen. If there's a face, stay awake; otherwise, dim the screen to save power. RequirementsTo do this, three things are needed:
Implementation; OS X 10.5, "Leopard" & MBPHere's what I used:
ioregioreg is a utility which displays the values of lots of system information, including the idle time of the system. The only hard part is finding and extracting the right key. This worked for me: What you see when that runs is the idle time in NANO-seconds (that's a 10^9 multiplier). Convert it to a number and divide by 1,000,000,000 to get the actual idle time in seconds. OpenCVThis is the most complicated part, but also the coolest component of all this.
If you're like me and accidentally installed it in /opt/local/
then you'll have to dig around in there to find what you need. Specifically, I found the associated files in
The Python package will be in a folder called "site-packages/opencv" and contains some compiled stuff and some python stuff.
This is a complete Python module, and should be copied to the native Python install folder
/Library/Python/2.5/site-packages
For me, the examples were in /opt/local/var/macports/software/opencv/1.0.0_0/opt/local/share/opencv
IOGraphicsLibDealing with low-level OS stuff, like brightness, has a somewhat steep learning curve. Thankfully, Nicholas Riley posted a program to do exactly what we need - detect & modify display brightness.
Download
the file at the bottom of this page
, then run:
Putting it Together |