How to lock the screen in GNOME

I’m sure that many of you are used with the <Win>+<L> key combination in
windows, to lock the screen. In Ubuntu (the distro I use), the
corespondent shortcut is <CTRL>+<ALT>+<L>. But, in many other distros
there is no shortcut for this command. Here is what you can do to assign a shortcut for locking the screen. (In order to do that, you have to activate the Win key. Read “How to use the Win key in Linux” to find out how to do it.)
Open the gconf-editor by typing “gconf-editor” in the terminal.

nongeek@mma:~$ gconf-editor

Go to: apps>metacity>keybinding_commands

select keybindings-commnads

Modify one of the commands (e.g. run_command_1). To do that, double-click
on it.
In the Value field of the window that will appear we will type the
gnome
screensaver command for locking the screen. Let’s type
gnome-screensaver-command - -lock and click the OK button.

Insert the command in Value field

Go to apps>metacity>global_keybindings.

insert key combination

Look for the “run_command_1″ and double-click on it.
In the Value field type the key combination you want for the lock screen
command. I typed <Mod4>L. Click “Ok”

Insert the shortcut key combination

Restart the Xserver pressing <ALT><Backspace>.After you relog in, try
the new shortcut. If nothing happens, check if you typed right the key
combination gconf-editor. If you get some error message about the
command, check if you typed right the command for gnome screensaver.
In the same way you can change the shortcut for the desktop from
<CTRL><ALT>D to <WIN>D


Bookmark and Share

3 Responses to “How to lock the screen in GNOME”


  1. 1 Binny V A May 21, 2008 at 5:16 pm

    There is a much simpler way to ‘lock’ the screen for me - Ctrt+Alt+F1

    No one here knows the Alt-F7 combination to go back to the graphics mode ;-)

  2. 2 nongeekboy May 21, 2008 at 7:22 pm

    :)) Yes, you’re very right. The (virtual) console is a “the scarry linux thing” for most of the people.

  3. 3 Indivisibly June 19, 2008 at 12:51 pm

    Somehow i missed the point. Probably lost in translation :) Anyway … nice blog to visit.

    cheers, Indivisibly!

Leave a Reply