Skip to main content

Replace xscreensaver in CrunchBang Linux 10 "Startler"

Deep down in my heart I am a minimalist and to me CrunchBang Linux has the right balance between minimalism and usefulness. However, one thing I've always struggled with it is the choice of xscreensaver for the simple lock screen task because it also does monitor power management, which has to be turned off to avoid conflict with xfce4 power manager.

Last week I finally decided to bite the bullet and replaced it with much simpler slock and here's how I did it.

Step 1 - Remove xscreensaver and install the screen locker of your choice

To remove xscreensaver simply:

sudo apt-get purge xscreensaver

Next, you'll need to install xautolock to lock screen automatically after certain idle time (mine's set to 1 minute):

sudo apt-get install xautolock

Now you have to choose a screen locker. I use slock, which is probably the simplest screen lock ever because all you get is a blank lock screen. There's also xtrlock, which is installed by apt automatically when I installed xautolock and i3lock, which allows you to choose a background image for the lock screen.

Once you've decided which one you wanna use, here's the hackery part of the job. You need to:

cd /usr/bin
sudo ln -s slock xflock4

Right now you might be thinking, "gee this is a hack, there must be a better way". The truth is there really isn't because the XFce4 Power Manager is hard-coded to try a list of screen lockers in the source code:

xfpm_lock_screen (void)
    gboolean ret = g_spawn_command_line_async ("xflock4", NULL);

    if ( !ret )
        g_spawn_command_line_async ("gnome-screensaver-command -l", NULL);

    if ( !ret )
        /* this should be the default*/
        ret = g_spawn_command_line_async ("xdg-screensaver lock", NULL);

    if ( !ret )
        ret = g_spawn_command_line_async ("xscreensaver-command -lock", NULL);

    if ( !ret )
        g_critical ("Connot lock screen\n");

Step 2 - Auto start xautolock

You need to add the following line to ~/.config/openbox/autostart to auto start the xautolock with right idle interval in minutes and screen locker name:

xautolock -time 1 -locker "slock" &

Remember to replace slock with the screen locker of your choice.

Step 3 - Update lock screen keyboard shortcut

Finally, find the following section in the ~/.config/openbox/rc.xml and enter the screen locker name in the <Command></Command> section.

<keybind key="W-l">
  <action name="Execute">
        <name>Lock screen</name>


  1. I think you have a mistake in your symlink creation. I believe you meant this:

    sudo ln -s slock xflock4

  2. Yes you are right and I've corrected it thanks

  3. After this, I went to reinstall Xscreensaver, & now it won't run. Any suggestions?

  4. Hi, if you delete the soft link /usr/bin/xflock4 created on step:

    sudo ln -s slock xflock4

    and remove the autostart entry from your


    the hardcoded if...else block should take care of the rest


Post a Comment

Popular posts from this blog

Load Testing ASP.NET Sites with JMeter

Following my previous post about using JMeter to test MOSS, I tried to figure out what are the bare minimum requirements of using JMeter against a plain ASP.NET website. I wrote a very simple ASP.NET web application with just a button, a text fields and a static label. This application displays the content of a text file in the static label when it loads and write content of the text field back to the file when the button is clicked. I found all I need to do in order to script this using JMeter is to extract __VIEWSTATE and __EVENTVALIDATION fields then send them back in the update request. My JMeter test plain looks like this:

Load Testing SharePoint (MOSS) Sites with JMeter

I have used JMeter for load testing few non-ASP.NET web sites before, however I could not get it to work with ASP.NET web sites. This is mainly due to ASP.NET ViewState and event validations, which stops a recorded JMeter script from being played back. Recently I worked on a MOSS project and we were looking for tools to perform load testing on the server. Many people said the load testing tool in Microsoft Team System for Testers works well with MOSS. However, it is quite expensive so I decided to give JMeter another go. After several hours of hacking, I actually got it to work and here’s how I did it. My test page is the pretty standard MOSS edit document property screen with few extra text fields added and the goal here is to use a JMeter script to change the document properties. Once I have a working script, I can configure JMeter to fire hundreds of instances of this script simultaneously to simulate the user workload. As shown in the screenshot below, the test plan contai

Coromandel Trip - Xmas 2019

Few weeks ago, my son watched a Youtube video about hot water beach and was really excited when I told him it is in New Zealand so we decided to take an impromptu trip there before Xmas. Hot water beach is actually only around 2.5 hours drive from Auckland but the wife didn't want to sit in the car for 5 hours in the same day. Fortunately we managed to find a nice holiday apartment in Whitianga despite busy holiday season, which is a nice small beach-side town only 30 minutes away from the hot water beach. Kids @ Whitianga beach Day 1 Hot water beach The best time to dig your own hot spa at the hot water beach is one hour on either side of the low tide, which was around 10:15am on the day. We decided to leave early and drove there first thing in the morning. We managed to get there by 10:45am but the beach was already packed with visitors. We tried to find an empty spot and started digging with our big garden spade (most people were using mini toy-like ones) but only c