Since you have disabled the gnome-screensaver, the dbus object
org.gnome.ScreenSaver is not created while the Gnome starts.
We need to create the dbus object org.gnome.ScreenSaver and implement
the Lock method.
I use the below python script to create the org.gnome.ScreenSaver.
----------- myscreen-dbus.py --------
#!/usr/bin/python
import dbus
import dbus.service
import dbus.glib
import gobject
import os
class ScreenDbusObj(dbus.service.Object):
def __init__(self):
session_bus = dbus.SessionBus()
bus_name=dbus.service.BusName("org.gnome.ScreenSaver",bus=session_bus)
dbus.service.Object.__init__(self,bus_name, '/org/gnome/ScreenSaver')
@dbus.service.method("org.gnome.ScreenSaver")
def Lock(self):
os.system( "xscreensaver-command -lock" )
if __name__ == '__main__':
object=ScreenDbusObj()
gobject.MainLoop().run()
You should keep this script running on the background. The 'Lock Screen' button
will call the method Lock and the method Lock will execute the
xscreensaver-command -lock.
To automatically start this script, you need to add the command, i.e.
/path-to-the-script/myscreen-dbus.py & in the
System/Preferences/Sessions.
P.S.
You don't need the ScreenSaver .service file
--
lock screen fails with xscreensaver
https://bugs.launchpad.net/bugs/528094
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs