I am running Arch Linux + Fluxbox. I have installed i3lock but the screen won't lock automatically as the program isn't designed to do that. Now, I want to change the default lock screen in xscreensaver package to i3lock. I have no idea about how to do that. Any other alternative method that automatically locks the screen after a period of inactivity using i3lock would be equally accepted.


I would suggest using xautolock. It is specifically designed to start arbitrary programs in idle X sessions. (It is also mentioned in the i3lock manpage)

In order to lock your screen with i3lock after 10 minutes of idle time, you just have to run:

xautolock -locker i3lock

If you want to pass some arguments to i3lock and change the timeout to 5 minutes you can do so like this:

xautolock -time 5 -locker 'i3lock -e -c 007f7f'

You can also use the xautolock command to control a running xautolock session, for example if you started it from your ~/.i3/config.

  • Immediately lock screen:

    xautolock -locknow
  • Temporarily disable locking

    xautolock -disable
  • (Re-)enable locking: xautolock -enable

  • Toggle between enabled and disabled:

    xautolock -toggle

For more information have a look at the xautolock manpage.

  • 1
    Very good use of examples in the answer. Feb 10 '17 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.