Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
D-Bus service providing org.gnome.ScreenSaver GetActive method for slimlock
#!/usr/bin/env python2
import dbus
import dbus.mainloop.glib
import dbus.service
import gobject
import psutil
class ScreenSaver(dbus.service.Object):
def __init__(self):
self.session_bus = dbus.SessionBus()
name = dbus.service.BusName("org.gnome.ScreenSaver", bus=self.session_bus)
dbus.service.Object.__init__(self, name, "/")
@dbus.service.method("org.gnome.ScreenSaver", in_signature='', out_signature='b')
def GetActive(self):
for pid in psutil.process_iter():
if == "slimlock":
return True
return False
if __name__ == '__main__':
loop = gobject.MainLoop()
object = ScreenSaver()
[D-BUS Service]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.