Xfce4 comes without any screensaver or utility that lets you lock the screen up. This is a security issue if you have to leave your computer alone for a while, for instance, when you go to break during class. I did a research and I found there’s a command for Xfce4 called xflock4 that locks your screen up, but it failed showing this message:
/usr/bin/xflock4: line 22: xlock: command not found
I didn’t want to install a screensaver but I had to, because it seems the lock function is only provided by a utility like gnome-screensaver or xsreensaver. Due to I’m not using Gnome I chose the latter.
On Debian you can install xscreensaver package as follow:
aptitude install xscreensaver
You can start xscreensaver by executing this command:
It will run in background as a daemon, checking for idleness to launch the screensaver or a command.
Locking the screen up
You can lock your screen up by executing the following command:
As far as now you have installed, run and invoked the screensaver, but how is all this related to Xfce?
Setting xscreensaver in Xfce4
You have to execute xscreensaver every time you log in into Xfce4, so you have to use Xfce4’s Session and startup feature. Just go to Applications > Xfce Settings > Session and startup and add the following:
The -no-splash option tells to xscreensaver not to splash the setting dialog box while starting in background.
Setting a shortcut
In Gnome you can use the keystroke Ctrl+Alt+L to lock the screen up (in Windows you can do the same by pressing Windows button + L). If you want to have something like that in Xfce4 go to Applications > Settings > Xfce 4 Setting manager and select the Keyboard icon.
There are add the shortcut with this command:
By the way, after installing xscreensaver you will be able to use the xflock4 command…