+(track this down:
+dginn% ./oble -c ~/Downloads/haarcascade_frontalface_alt.xml
+Corrupt JPEG data: 160038 extraneous bytes before marker 0x69
+ERROR: frame is null...)
FOR SCREENSAVER:
* gnome-screensaver-command --poke
* find irc channel to ask if my understanding is correct
* file bug
* track down bug
* compile gnome-screensaver
-* cli opt parse
- * quiet mode
- * no display window
- * no text printed to terminal
-* fire up the face detector only just before going to inactive mode.
- * possibly this is how kreed's version works. read kreed's code to find out
- * that way the camera isn't running all the time
- * maybe start 10 seconds before going inactive, then run until activity, or 10
- seconds, whichever's first.
-* be more aggressive with turning off the screen. dim the screen as soon as
-it's not being looked at. turn it off soon thereafter.
- * could be enough to save battery. would need to power the camera sometimes,
- but would save on backlight. need to profile.
-* don't prevent sleep when face is detected, but user isn't actually looking at
-screen.
- * requires pose estimation.
- * also requires estimating the direction of the eye.
-
-OTHER IDEAS:
-* authenticating a user based on face recognition (as opposed to face
-detection)
- * much more difficult to do reliably
- * use object tracking and emotion estimation to require a set of facial
- expressions as authentication.
- * awesome for people who find typing hard, eg: no hands
+
+http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/#comment-1927
+in c:
+#include <X11/extensions/scrnsaver.h>
+
+main() {
+ XScreenSaverInfo *info = XScreenSaverAllocInfo();
+ Display *display = XOpenDisplay(0);
+
+ XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
+ printf("%u ms\n", info->idle);
+}
+in ruby inline:
+require 'inline'
+
+class XScreenSaver
+ class << self
+ inline do |builder|
+ builder.add_link_flags '-lXss'
+ builder.include '<X11/extensions/scrnsaver.h>'
+ builder.c %{
+ double idle_time() {
+ static Display *display;
+ XScreenSaverInfo *info = XScreenSaverAllocInfo();
+
+ if (!display) display = XOpenDisplay(0);
+ if (!display) return -1;
+
+ XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
+
+ return info->idle / 1000.0;
+ }
+ }
+ end
+ end
+end
+
+if __FILE__ == $0
+ loop { puts XScreenSaver.idle_time; sleep 0.2 }
+end
+