How to lock the screen in XUbuntu 16.04
Here's the default Xubuntu setup:
- light-locker is set to autostart because it must be running in the background to work
- Keyboard shortcuts for Ctrl+Alt+Del and Ctrl+Alt+L are configured that call
xflock4
-
xflock4
calls light-locker to lock the screen
If you run xflock4
in a terminal and nothing happens, odds are light-locker isn't running. The solution more or less is to restore the default settings:
-
Remove light-locker-settings package. It's not necessary because screen lock settings are handled by Xfce Power Manager (as you can see in the screenshot you posted)
sudo apt remove light-locker-settings
-
Make sure essential packages are installed (just to be safe)
sudo apt install light-locker xfce4-power-manager xfce4-session
-
Reset light-locker settings
sudo dpkg-reconfigure light-locker
-
Remove any autostart overrides
rm ~/.config/autostart/light-locker.desktop
(This can be removed because the light-locker package installs a default autostart file here: /etc/xdg/autostart/light-locker.desktop)
-
Reset the LockCommand setting in case it's been overrriden
xfconf-query -c xfce4-session -p /general/LockCommand -r
(
xflock4
is just a shell script that will first look at LockCommand to see what command to run, falling back to light-locker if it isn't set) -
Reset keyboard shortcuts
-
If you're not worried about losing any other custom keyboard shortcuts, you can just reset them all to default:
xfconf-query -c xfce4-keyboard-shortcuts -p / -rR
-
Otherwise, these are the specific keyboard shortcuts Xubuntu sets by default for screen locking:
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Primary><Alt>Delete" -s "xflock4" -n -t string xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Primary><Alt>l" -s "xflock4" -n -t string xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/default/<Primary><Alt>Delete" -s "xflock4" -n -t string xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/default/<Primary><Alt>l" -s "xflock4" -n -t string
-
Log out and log back in. This will make sure light-locker autostart is working and also may be necessary for the keyboard shortcuts to refresh.
-
Make sure light-locker is running
$ ps -e | grep light-locker 1869 ? 00:00:00 light-locker
-
Make sure
xflock4
locks the screenxflock4
-
Make sure the keyboard shortcuts to lock the screen work
- Ctrl+Alt+Del
- Ctrl+Alt+L
-
Lastly, if you want the screen to automatically lock after a certain time
Open the menu > Settings > Power Manager > Security
Automatically lock the session > When the screensaver is activated
If you want to have a real screensaver, you'll need to install and configure
xscreensaver
orgnome-screensaver
. Otherwise if you're okay with a blank screen, go to the Display tab in Power Manager and adjust the times as desired
To lock the screen in xubuntu:
Ctrl+Alt+L
Note: The time os the button matters, try it several times to get it right.
Image: see line xflock4 Ctrl+Alt+L