4

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.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Ceda EI
  • 290
  • 4
  • 9

1 Answers1

11

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.

Adaephon
  • 4,356
  • 1
  • 25
  • 28