gss-poke by [Un]Inhibit doesn't work
authorozzloy <ozzloy@zero7.(none)>
Sun, 7 Feb 2010 22:40:59 +0000 (14:40 -0800)
committerozzloy <ozzloy@zero7.(none)>
Sun, 7 Feb 2010 22:40:59 +0000 (14:40 -0800)
adding the gss script and commented code to demonstraow it was used.  tried
inhibiting and uninhibiting the screensaver every time a face was detected, but
that didn't prevent gss from activating due to timer.  this is frustrating.

next i will try xdg-screensaver suspend / resume

TODO
gss-poke.py [new file with mode: 0755]
oble.cpp

diff --git a/TODO b/TODO
index 34ac061d4775d01abe6c10a5d0acb9fd36d3d1b0..6dae6432bd9d736d79ebc9e2d82fc42f933a47ed 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
 FOR SCREENSAVER:
 * use [Un]Inhibit together as a SimulateUserActivity workalike
+       * disablegss.py from http://ubuntuforums.org/showthread.php?t=284804
+       * this method doesn't work either.  tried in gss-poke.py
 * xdg-screensaver suspend / resume to SimulateUserActivity
        * http://tronche.com/gui/x/xlib-tutorial/2nd-program-anatomy.html
        * http://portland.freedesktop.org/xdg-utils-1.0beta3/xdg-screensaver.html
diff --git a/gss-poke.py b/gss-poke.py
new file mode 100755 (executable)
index 0000000..78a4d69
--- /dev/null
@@ -0,0 +1,72 @@
+#! /usr/bin/env python
+#inhibit then uninhibit gnome-screensaver.  this is a kludge for
+#SimulateUserActivity
+#Copyright 2010 Daniel Watson
+'''
+    use a camera to prevent screensaver
+    Copyright (C) 2009  daniel watson, ozzloy@gmail.com
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+'''
+        This file is part of oble.
+
+        oble is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, either version 3 of the License, or
+        (at your option) any later version.
+
+        oble is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with oble.  If not, see <http://www.gnu.org/licenses/>.
+
+'''
+
+
+import dbus
+import dbus.glib
+import sys
+import time
+
+def inhibit():
+  try:
+    bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
+    devobj = bus.get_object('org.gnome.ScreenSaver',  '/org/gnome/ScreenSaver')
+    dev = dbus.Interface(devobj, "org.gnome.ScreenSaver")
+    cookie = dev.Inhibit('gss-poke', 'SimulateUserActivity kludge')
+    print "gnome screensaver inhibited."    
+    return (dev, cookie)
+  except Exception, e:
+    print "could not send the dbus Inhibit signal: %s" % e
+    return (False, False)
+
+def uninhibit(dev, cookie):
+  try:
+    dev.UnInhibit(cookie)
+    print "gnome screensaver enabled."
+    return(True)  
+  except Exception, e:
+    print "could not send the dbus UnInhibit signal: %s" % e
+    return (False)
+
+if __name__ == '__main__':
+  (dev, cookie) = inhibit()
+  time.sleep(0.1)
+  uninhibit(dev, cookie)
+  sys.exit(0)
index ffc61f043191029890c37e4ff88915be3bf1f61f..ab7d509341105b2a942a45dd1558d27c371ba232 100644 (file)
--- a/oble.cpp
+++ b/oble.cpp
@@ -77,6 +77,7 @@ void detect_and_draw_objects(IplImage* image,
        if(0 < faces->total)
        {
                t_current = time(NULL);
+               //system("./gss-poke.py");
        }
 
        /* draw all the rectangles */