86

I tried the combination CTRL+ALT+L or L but it is not working. But if I select the menu item Lock screen from the Setting drop down it works.

Any thoughts on how to fix keyboard shortcut?

4
  • 1
    you will find a fast workaround here "go to System Settings > Keyboard and on the "Shortcuts" tab, under "System", change the "Lock screen" keyboard shortcut from CTRL + ALT + L to something else, then under "Custom Shortcuts", click the "+" button to add a new custom shortcut, under "Name" enter "Xscreensaver" and under "Command" enter "/usr/bin/xscreensaver-command", then click "Apply"." Apr 28, 2012 at 7:29
  • Thanks @Marius Balaban. That helped.I cleared the shortcut and re-entered the CTRL+ALT+L combination and it worked. I tried to put it as solution but can't do that due to less reputation. Apr 28, 2012 at 7:39
  • 1
    In my instance it was because my notebook keyboard implements a numeric keypad if the Num Lock is on. So my [Ctrl]-[ALt]-L was really [Ctrl]-[Alt]-3. Once I hit the Num Lock again to turn it off [Ctrl]-[Alt]-L worked again. May 10, 2013 at 0:35
  • 1
    For xubuntu / Xfce , use the command xflock4 to lock the computer (see askubuntu.com/questions/883671/… ) Jan 16, 2019 at 13:40

10 Answers 10

79

In the top panel right corner choose System Settings to select Keyboard in the Hardware section, or type "key.." in the Dash then select Keyboard:

enter image description here

In the Shortcuts tab all key combinations are listed. You may change them there or add your own custom shortcut. To have the poweroff shortcut back add it with a custom shortcut for the following command:

gnome-session-quit --power-off

Note: to be able to add a custom shortcut we may have to clear an already existing shortcut if this uses the same keys.

The GNOME lock screen feature depends on the gnome-screensaver Install gnome-screensaver. In case you have removed it or did not install it in a custom environment you will have to install it first.

6
  • 7
    I changed the combination to Super+L but it is not working. Any thoughts? Apr 28, 2012 at 8:09
  • 3
    thanks for your edit. I changed the key to CTRL+ALT+G and that worked. But changing it to Super+L is still not working. On Windows I am used to Windows+L hence same would be helpful on Ubuntu. Thanks Apr 28, 2012 at 8:20
  • 1
    FYI: These instructions work for CentOS 7 as well (and probably any other GNOME 3 install). Super+L works for me. I also set Super+R for "run", like Windows. Jan 3, 2015 at 3:53
  • 2
    Strange. It was already set to Ctrl+Alt+L. This was what I always used, but all of a sudden it stopped working. But after resetting the shortcut to Ctrl+Alt+L, it started working again. Why did this glitch occur in the first place? I did change switch keyboard layouts back and forth once; could this be the reason?
    – Ébe Isaac
    Jun 13, 2016 at 5:31
  • My lock screen is currently set to Super+L but it is not working. This was after a recent update. Any ideas how to fix it? Mar 5, 2022 at 20:39
17

I was experiencing this symptom, but none of the above solutions were working. I found out that this was because I had previously disabled the screen lock because I did not want the screen to lock when the screensaver starts.

The takeaway is that screen lock will not work unless it is enabled in your gnome settings. You can ensure it is enabled with the following command:

# Note the disable flag is set to false, so its really enabling the behavior
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false'

After running this, the Super+L hotkey worked fine.

3
  • 3
    this was a solution for me (ubuntu 20 Focal)
    – Gabriel
    May 4, 2020 at 19:16
  • Fixed it for me on Ubuntu 20.10. Perhaps the Caffeïne extension is wrongfully causing the value to remain 'true' even when set to "empty cup"? For me, the issue started after a reboot, will keep an eye on it.
    – iGadget
    Nov 10, 2020 at 10:28
  • 1
    I tried this and it had no effect. Mar 5, 2022 at 20:39
13

This seems to have been improved in 12.10.

If you go into System Settings > Keyboard > Shortcuts, System,

then left-click once on 'Lock screen',

the Ctrl+Alt+L on the right changes to 'New accelerator...[something]', at which point you can hold Super [Windows key] and press L.

The keyboard shortcut will then show as 'Super+L' and works immediately.

9

This is also an issue in 20.04 when using lightdm. For the default lock screen shortcut to work switch to gdm3.

For lightdm you need to add a custom shortcut with the command dm-tool lock.

4
  • Thanks for your first answer @Flo! The question is 7 years old, so the issues was probably unrelated to 20.04, though. As a side-note, it's hard to build up rep answering old questions. Have a crack at the feed of new questions, where you're more likely to get an upvote or ticked as the correct answer.
    – Kurankat
    Apr 24, 2020 at 23:11
  • 2
    @Flo thanks for taking the time to share this. I really needed the screen lock shortcut to work with lightdm.The point of SO is not so much to answer the OP's question but to provide a repository of solutions that other people can use. Good on you to keep the answers up to date. Great first post.
    – asac
    Jun 29, 2020 at 9:59
  • This solved my issue after installing lightdm and losing the ability to lock my screen using the shortcut -- thanks so much!
    – wellington
    Nov 12, 2021 at 22:40
  • This apparently is also the main problem in 22.04. I never had this issue in 20.04 even though I was using lightdm.
    – Cerin
    Jan 8 at 15:31
2

For my debian based crunchbag Distro the Window_Logo_Key+L is the shortcut for locking the screen but you of course change it as mentioned above

2

Sorry for abusing old threads but I looked too for this issue and want to share my experiences without opening a new thread for this, to avoid more waste data. Today I figured out that both lock screen (like mentioned above) and monitor standby was disabled. And gnome-screensaver was removed. But I didn't disabled both of them nor removed gnome-screensaver. What the heck is going on here?! What did disable them?

Ah btw. I'm use Ubuntu 20.04 and Nvidia display driver.

Edit: I know now what it is. It's the Phoronix Benchmark Test. It disables the lock screen and display standby.

1
  • How obnoxious! I just ran Phoronix yesterday and noticed hours later that I couldn't lock the screen. I never would have connected the two. Thanks!
    – Planky
    Mar 19 at 17:17
1

I also suffered when turning off the screen, could only turn off the computer. But for myself, I found a solution: Ctrl + Alt + F1 a terminal without a graphical shell will appear and immediately a Ctrl + Alt + F8 will be prompted to log in. Good luck.

0

In Kubuntu version 18.04 / Plasma, this appears to be found under "Screen Locking". From the start menu, type "Screen..." and you'll see the applet allowing you to change this setting.

0

For Xubuntu (18.04) the command is flock4. It can be associated with shortcut via:

Menu / Keyboard / Application Shortcuts
0

None of the answers here worked for me.

Instead, based on this, I installed gnome-screensaver and set Super+L to the following command: gnome-screensaver-command -l. Works like a charm.

1
  • gnome-screensaver-command -l did nothing in my case. Ubuntu 22.04 gdm3
    – DiDebru
    Dec 15, 2022 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .