I just (January 2018) tried to get screen locking working under XFCE. I'm a little surprised it didn't work by default. I initially tried to install
xscreensaver but neither worked.
What worked for me was to install the
xlockmore package which provided
/usr/bin/xlock which seems to work great. With that command now installed, I was able to configure the xfce session to use it:
xfconf-query -c xfce4-session -p /general/LockCommand -s "xlock"
or if you don't have the variable yet:
xfconf-query -c xfce4-session -p /general/LockCommand -s "xlock" --create -t string
/usr/bin/xflock4 script already pays attention to that
LockCommand setting so there was no need to edit the script once I had the setting applied.
Xlock has a ton of different modes and settings which, by default, it randomizes through. I settled on:
xlock -mode goop -erasedelay 0
To test them use:
xlock -mode ... -nolock