root/utils/mimic_gnome-screensaver.py

Revision d1a41d2b9e8293b7310d616fd8ccd24ddf38d9be, 0.9 KB (checked in by Leo Antunes <leo@…>, 2 years ago)

- store changed status as pref and restore at startup if it exists:

avoid awayonlock messing with the last-online status if you quit
while idle.

- minor tweaks and fixes to the test script

  • Property mode set to 100644
Line 
1#!/usr/bin/env python
2
3"""
4incredibly dirty hack to test away-on-lock
5if gnome-screensaver is already running this wont work (it wont be able
6to pretend to be gnome-screensaver)
7"""
8
9import dbus, dbus.service, gobject
10from dbus.mainloop.glib import DBusGMainLoop
11from dbus.service import BusName
12
13bus = dbus.SessionBus(mainloop=DBusGMainLoop())
14
15class Test(dbus.service.Object):
16        def __init__(self, path):
17                dbus.service.Object.__init__(self, bus, path)
18
19        x = dbus.Boolean(1);
20
21        @dbus.service.signal(dbus_interface='org.gnome.ScreenSaver', signature='b')
22        def ActiveChanged(self, y):
23                print "emmitting...", repr(y)
24                return True
25
26name = BusName(name="org.gnome.ScreenSaver", bus=bus);
27
28app = gobject.MainLoop()
29
30t = Test('/org/gnome/ScreenSaver')
31gobject.timeout_add(   1, t.ActiveChanged, dbus.Boolean(1))
32gobject.timeout_add(5000, t.ActiveChanged, dbus.Boolean(0))
33gobject.timeout_add(5001, app.quit)
34
35app.run()
Note: See TracBrowser for help on using the browser.