Ubuntu – Key short cut `Super+L` (i.e. `Win+L`) not working for `LockScreen` in 12.04 LTS

12.04lock-screen

I want to change Key short cut to Super+L for LockScreen but it is not working. If I try any other combination like CTRL+ALT+L or CTRL+ALT+G , it works.
Win+L combination used to work in 11.10.

enter image description here

Best Answer

Yes, it's very annoying, and hard to remember the exact fix. So hopefully this will help you, and also be an easy way for me to look this up next time I do a fresh Ubuntu install.

There is duplication & conflict between the Gnome Keyboard Shortcut settings (as depicted in your screen shot) and the same settings in the new Unity desktop. Ubuntu (well, Gnome) provides a UI for editing the Gnome Keyboard Shortcut settings but as you've learned, they don't work if they conflict with Unity. And there is no UI installed by default for managing Unity.

Note that to get 'Super-X' style shortcuts to work, you will have to change the 'key to show the launcher' setting, which means that the Super/Windows key will no longer open the launcher. If that's OK with you, continue...

Here is what I do:

  1. Install compizconfig-settings-manager (some will warn you not to, because it gives you enough power to really mess things up). There may be a way to change these without using CCSM but if so, I don't know it. Install it via the Ubuntu Software Center, or:

    $ sudo apt-get install compizconfig-settings-manager

  2. Run CompizConfig Settings Manager; acknowledge the warning message.

  3. Locate and click the Ubuntu Unity Plugin icon in the Desktop section
  4. Change the Key to show the launcher (on the Behaviour tab). To do this:
    • Click the button which says <Super>
    • Click Grab key combination
    • Press a new key or key combination (this will, from now on, open the Unity launcher); I use <Alt>-<Super>

CompizConfig Settings Manager - changing launcher key

The <Super>-L 'Lock Screen' combination that you already set up should now just work!

Bonus

Note that CCSM also provides its own facility for setting keyboard shortcuts. For things not included in the gnome-control-center, you may have more luck defining custom shortcuts in CCSM. If you select Commands from the General section in CCSM, you can define custom commands, like I've done here: CompizConfig Settings Manager - Commands editor

...and then, you can associate those commands with specific key combinations, like this: CompizConfig Settings Manager - Key bindings

As you can see, I've configured Super-E to launch the Gnome text editor, and Super-C to launch the calculator. I find both of these very handy.