Gnome – How to Lock Screen in Gnome 3 Without GDM

gnomegnome-shellgnome3screen-lock

There is no "Lock" option showing up in the user menu, and the standard shortcuts (Ctrl+L or Ctrl+Alt+L) don't do anything.

I'm running Fedora 19 with Gnome Shell 3.8.3, and XDM 1.1.11.

I'm using XDM because of broken XDMCP support in GDM – but before I upgraded to Fedora 19, I did have the lock option, even when using XDM.

I've posted an answer reflecting the results of my own research. It basically says that it's not possible to have screen-lock integrated into Gnome 3.8 without running GDM.

I really hope there's a better answer available though – so please add your own answer if there's any way to do this that I overlooked.

Best Answer

After some research, I think I've got enough information to post an answer to my own question.

In Gnome Shell 3.6 and earlier, the old gnome-screensaver program was present, and if GDM was not running, gnome-screensaver would be invoked - allowing you to lock the screen.

Starting in Gnome Shell 3.8 (included in Fedora 19), gnome-screensaver support has been dropped completely. This was done for three reasons: reduced code complexity coupled with the fact that the screensaver is seen as an unneeded feature, and the fact that the eventual move to Wayland will require screensaver, locking, etc. support to be in the compositor.

So the only Gnome-integrated way of locking the screen is to have GDM running, which will respond to a dbus message telling it to lock the screen. Other display managers (such as XDM) have not been designed to respond to this dbus message, and so the screen cannot be locked.


From this link:

In old versions of gnome the command gnome-screensaver-command -l would lock your screen. As gnome-screensaver is no more in gnome 3.8 you now have to send a dbus call. I think this is then handled by GDM.

$ dbus-send --type=method_call --dest=org.gnome.ScreenSaver \
    /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
Related Question