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.
Asked
Active
Viewed 6,472 times
4
Rui F Ribeiro
- 55,929
- 26
- 146
- 227
Ceda EI
- 290
- 4
- 9
1 Answers
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 -locknowTemporarily 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
-
1Very good use of examples in the answer. – David C. Rankin Feb 10 '17 at 01:40