In this howto I tell how you can set which utility is used for locking desktop in Xfce that is the desktop environment used in Xubuntu. You can launch the lock by <Crtl><Alt><Del> in Xubuntu, by default. The keyboard shortcut runs a Bourne shell script named xflock4. It is located at /usr/bin/. You can make a customized version and save it to /usr/local/bin/xflock4. That will be used instead of the default one, since /usr/local/bin/ directory is searched before /usr/bin/ for commands. (That is set in PATH environment variable.)
Here is the customized xflock4 I wrote:
You can save it as /usr/local/bin/xflock4 and make it executable by command
case "$DESKTOP_LOCK_UTILITY" in
if xscreensaver-command -lock 2>/dev/null; then
if gnome-screensaver-command --lock 2>/dev/null; then
# xtrlock leaves desktop visible
if test -n "`which xtrlock 2>/dev/null`"; then
# Try xlock by default and if nothing else works
if test -n "`which xlock 2>/dev/null`"; then
xlock -mode blank $* &
sudo chmod a+x /usr/local/bin/xflock4
You can choose the preferred locking utility by setting an environment variable named DESKTOP_LOCK_UTILITY. The current options are xscreensaver, gnome-screensaver, xtrlock and xlock. Of course, you have to install the utility of your preference before you use it. In case your preference is xscreensaver or gnome-screensaver, you have to start a respective screensaver daemon in xinitrc. (There are instructions for that in another howto that I authored. I link it here once I know its url; the howto has to be accepted by moderators first.) UPDATE: See here for a hint on how to edit xinitrc script.
xtrlock is a special kind of desktop locking utility that does not hide screen. Once you have installed it, I recommend reading its short manual by in terminal.
NOTE 2009-04-01: I found that xtrlock does not work always, so you may consider not using it for now.
Here it is told how to use environment variables in Ubuntu distributions.