My screen doesn't get locked after I close my laptop lid. The laptop suspends but the screen is not locked.
I checked multiple settings:
gnome-control-center > brightness & lock > lock on and require password when waking from suspend enabled
dconf-editor > org/gnome/desktop/lockdown/disable-lock-screen disabled
dconf-editor > org/gnome/desktop/screensaver/lock-enabled enabled
dconf-editor > org/gnome/desktop/screensaver/ubuntu-lock-on-suspend enabled
But can't get to lock my screen after suspend. What else can I try?
Best Answer
Not a solution, but you may use this script as a workaround:
This works with stock Ubuntu with Unity desktop. The approach is specific to Unity, although there are
dbus
calls to suspend regardless of the desktop environment. For 16.04 , one could usesystemctl suspend
command. See the relevant post: https://askubuntu.com/a/1795/295286Alternative (older answer, edited)
One of the other tools for suspending, that works regardless of the Ubuntu version is
pm-suspend
. Problem is that it requires root privilege. To work around that, add pm-suspend to/etc/sudoers
file to be executed without password ( more info here ).In particular, in my
/etc/sudoers
I have the following:Thus, you can use:
The
sudo pm-suspend
won't prompt you for password then.