Originally Posted by
dhasenan
If you want System->Quit->Lock Screen to work, just do this:
Code:
$ sudo ln -f /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command
after following the rest of that guide. The query, throttle, and unthrottle flags from gnome-screensaver-command won't work, though.
This won't work at least in Gnome 2.22.3.
The 'Lock Screen' actually only send a dbus request to invoke the lock method of the dbus object org.gnome.ScreenSaver.
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 --------
Code:
#!/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.
Furthermore, the options is used by xscreensaver-command and gnome-screensaver-command for lock is different. For xscreensaver-command, the option is -lock. But for gnome-screensaver-command, the option is --lock ( there are two hyphen before the 'lock').
Bookmarks