+++ /dev/null
-#! /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)