Home > debian, linux, xfce > Use xtrlock via XFCE 4.8 lock button

Use xtrlock via XFCE 4.8 lock button

I currently use XFCE 4.8 on Debian Wheezy as my desktop system. Its panel supports so-called “action buttons” for hibernate, lock, shutdown, etc.

I use one of those buttons to lock the screen but I don’t like xscreensaver (too ugly, don’t need the screensaver stuff), gnome-screensaver (too many dependencies), xlock and its successor xlockmore (too ugly) or slock (just a black blank screen always confuses me).

Good thing is that I found xtrlock which does what I want: It just shows a lock symbol instead of the mouse cursor, all screen content is still visible but user interaction is blocked until the current user password has been typed in.

This is just enough to prevent my 2 and 5 year old children from messing around with my laptop. So I installed it:

sudo apt-get install xtrlock

Problem was that the XFCE lock button calls xflock4 which is a simple shell script that has hardcoded support for the afore-mentioned set of lock programs, but not for xtrlock.

My simple solution was to take advantage of /usr/local/bin being usually before /usr/bin in the PATH and create a script /usr/local/bin/xflock4 with this content:


Make it executable with

sudo chmod a+x /usr/local/bin/xflock4

Now I can use the XFCE lock button and get what I want.

Alternatively, there are a couple of other light-weight lock programs for Linux:

Categories: debian, linux, xfce Tags: ,
  1. March 12, 2014 at 00:36

    Next thing is a automatic screen locking after certain idle time. I think I will xautolock (with xtrlock) for that.

  2. Mediumcat
    December 6, 2014 at 16:23

    or just right-click the panel > select Add New Items > Program Launcher
    Set its name to Lock Session, icon to xfce-system-lock
    and command to /usr/bin/xtrlock

    Also you can set a hotkey combination for screen locking with any program in Xfce4 Settings Manager > Keyboard > Application Shortcuts

    • December 6, 2014 at 17:42

      Yes, that’s another good approach.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: