Created
February 13, 2012 14:09
-
-
Save qwerty12/1817171 to your computer and use it in GitHub Desktop.
Notification of gnome-screensaver state changes through D-Bus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import gobject, dbus | |
from dbus.mainloop.glib import DBusGMainLoop | |
def screensaver_state_changed(isActive): | |
print "locked" if isActive else "unlocked" | |
DBusGMainLoop(set_as_default=True) | |
sess_bus = dbus.SessionBus() | |
sess_bus.add_signal_receiver(screensaver_state_changed, path='/org/gnome/ScreenSaver', dbus_interface='org.gnome.ScreenSaver', signal_name='ActiveChanged') | |
gobject.MainLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment